legend

Issue displaying legend with ggplot2, nothing displaying … legend items have no correspnsing variable in df

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-16 16:24:10
问题 I am plotting a series of lines using ggplot and shading between them. There are 10 lines, but only 5 shaded regions. I want the legend for the 5 shaded regions. At the moment no legend is showing. I thought the line scale_color_manual(name="test",labels = c("90%","70%","50%","30%","10%"), values = c("Darkolivegreen1", "Darkolivegreen2","Darkolivegreen3","Darkolivegreen4","Darkolivegreen")) would add a manual colour bar with the shaded region, but nothing shows. The full plot code is below.

R Survival Curve Plot Legend

萝らか妹 提交于 2020-01-15 10:43:59
问题 I have a table that looks like this: ID Survival Event Allele 2 5 1 WildType 2 0 1 WildType 3 3 1 WildType 4 38 0 Variant I want to do a kaplan meier plot, and tell me if wild type or variants tend to survive longer. I have this code: library(survival) Table <-read.table("Table1",header=T) fit=survfit(Surv(Table$Survival,Table$Event)~Table$Allele) plot(fit,lty=2:3,col=3:4) From the fit p value, I can see that the survival of these two groups have significantly different survival curves.

R Survival Curve Plot Legend

[亡魂溺海] 提交于 2020-01-15 10:43:29
问题 I have a table that looks like this: ID Survival Event Allele 2 5 1 WildType 2 0 1 WildType 3 3 1 WildType 4 38 0 Variant I want to do a kaplan meier plot, and tell me if wild type or variants tend to survive longer. I have this code: library(survival) Table <-read.table("Table1",header=T) fit=survfit(Surv(Table$Survival,Table$Event)~Table$Allele) plot(fit,lty=2:3,col=3:4) From the fit p value, I can see that the survival of these two groups have significantly different survival curves.

R Survival Curve Plot Legend

穿精又带淫゛_ 提交于 2020-01-15 10:43:05
问题 I have a table that looks like this: ID Survival Event Allele 2 5 1 WildType 2 0 1 WildType 3 3 1 WildType 4 38 0 Variant I want to do a kaplan meier plot, and tell me if wild type or variants tend to survive longer. I have this code: library(survival) Table <-read.table("Table1",header=T) fit=survfit(Surv(Table$Survival,Table$Event)~Table$Allele) plot(fit,lty=2:3,col=3:4) From the fit p value, I can see that the survival of these two groups have significantly different survival curves.

How to change symbol in legend without changing it in the plot

∥☆過路亽.° 提交于 2020-01-15 10:28:11
问题 I'm trying to replicate the following plot: Plot to replicate I have gotten as far as this: My plot Hence, the only thing left to do is change the symbols in the legend to big round circles instead of small circles with a line going through them. How can I achieve this without making the circles in my plot bigger? I used the following code to create my plot so far: g <- ggplot(d, aes(x = Num.3.Syllable.Words / Num.Words, y = Num.Words / Num.Sentences, colour = Educational.Level)) g + geom

Theme elements in ggplot2 figure

六眼飞鱼酱① 提交于 2020-01-15 09:59:26
问题 I am trying to tweak a few thematic elements in a ggplot2 figure. My three questions/goals for this multi-layered figure are (code for data follows at end): Create a x-axis tick mark label for all eight year, i.e., 2004-2011. I do not want a 'xlab' though. Remove the two filled dots from the "Infected Stems" legend b/c these "geom_bars" should not have dots associated with them (???). Change the Legend Title for the lines/points legend to "SOD-dead Stems". My code is probably redundant to

Gnuplot: vertical space between series titles

▼魔方 西西 提交于 2020-01-15 07:51:19
问题 How to change the vertical space between series titles. Is it possible to separate the series titles into two groups and have a gap between them, like this one: Thanks. 回答1: You can insert some kind of 'dummy' plot where you want to have the white space: set xrange [0:4] set key left plot x, \ 2*x t '2x', \ NaN title ' ' lt -3,\ 3*x t '3x',\ 4*x t '4x' The special linetype -3 doesn't draw any line at all, using linewidth 0 wouldn't work for all terminals (e.g. postscript). And the title must

Python Scatter Plot with Colorbar and Legend Issues

三世轮回 提交于 2020-01-14 02:51:26
问题 I'm working with a pretty simple example. I create three scatter plots on the same set of axes, and each data set I plot has a different associated colormap. However, the legend does not look as I'd want it to; why is this? import numpy as np import matplotlib.pyplot as plt t = np.linspace(0,10,100) x = np.random.rand(100,3) y = np.random.rand(100,3) colmaps = ['Blues', 'Greys', 'Reds'] for i in range(3): plt.scatter(x[:,i], y[:,i], c=t, cmap=colmaps[i], label=i) plt.legend() plt.show() This

Transform numbers with exponents to plotmath commands for beautiful legends in R

给你一囗甜甜゛ 提交于 2020-01-13 23:18:04
问题 I'm trying to generate a beautiful legend in R plots. I have a factor=1e-5 , that should appear nicely formatted in the legend. I found a nice function in the package sfsmisc , that transforms numbers to expressions. To add this expression to my bquote command, it seems that I need to transform itto a call. unfortunately, there are braces added at the end of the string ( 10^-5() ). Is there a way to avoid the addition of thoses braces? Or is there even an easier way to transform numbers to

Transform numbers with exponents to plotmath commands for beautiful legends in R

无人久伴 提交于 2020-01-13 23:15:00
问题 I'm trying to generate a beautiful legend in R plots. I have a factor=1e-5 , that should appear nicely formatted in the legend. I found a nice function in the package sfsmisc , that transforms numbers to expressions. To add this expression to my bquote command, it seems that I need to transform itto a call. unfortunately, there are braces added at the end of the string ( 10^-5() ). Is there a way to avoid the addition of thoses braces? Or is there even an easier way to transform numbers to