Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 206260

How to customize the content of a legend of a dotplot with ggplot2

$
0
0

i am using this table:

fruit   value   feature Ratio
tomato  1.79614067223751    length  0.00983606557377
zucchini    3.03886853214095    size    0.034188034188034
tomato  1.64545172419968    size    0.013114754098361
potato  4.25443807208955    size    0.008383233532934
zucchini    5   colour  0.051282051282051
potato  1.46068422675856    magic   0.004790419161677
potato  5   flavour 0.011377245508982
tomato  4.86348870541553    flavour 0.026229508196721
zucchini    2.89808116631958    flavour 0.034188034188034

to produce this dotplot

Dotplot <- read.delim("test.txt", header = TRUE)

ggplot(Dotplot,aes(factor(fruit),feature)) + 
        geom_point(aes(colour=value,size=Ratio)) + 
        scale_colour_gradient(low="red", high="blue") + 
        scale_size(range=c(1,10)) + theme_bw() + 
        theme(axis.text=element_text(size=10), 
              axis.title=element_text(size=10,face="bold")) + 
        theme(axis.text.x = element_text(size = 12, angle = 90))

what i want is to customize the "Ratio" legend and double the quantity of dots to display even values for very small dots. Is that possible?

thanks in advance


Viewing all articles
Browse latest Browse all 206260

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>