legend

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

不打扰是莪最后的温柔 提交于 2020-01-13 23:13:36
问题 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

How to draw animated legend for subplots?

a 夏天 提交于 2020-01-13 05:00:30
问题 I would like to draw animated subplots with ArtistAnimation. Unfortunately, I cannot figure out how to have an animated legend. I tried out different methods I found on StackOverflow. If I manage to get a legend it is not animated, but just the legends of all animation steps together. My code looks like this: import numpy as np import pylab as pl import matplotlib.animation as anim fig, (ax1, ax2, ax3) = pl.subplots(1,3,figsize=(11,4)) ims = [] im1 = ['im11','im12','im13'] im2 = ['im21','im22

How to control winform mschart legend text alignment c#?

拥有回忆 提交于 2020-01-11 10:55:52
问题 How does one set the alignment of text within a chart legend object? I've tried using: myChartName.Legends["mySeriesName"].Alignment = stringAlignment.Near With no effect. I've also tried to create custom legend items, again resulting in no effect. Text is ALWAYS centered (along with the series marker) in the legend "box". The only text I have been able to align is the title, but I don't need titles in my application. My research to date says the legend object is basically a table with (by

ggplot2: missing legend and how to add?

被刻印的时光 ゝ 提交于 2020-01-11 10:31:52
问题 I want to plot a bar and line chart from a dataframe. Code below, library("ggplot2") numb <- c(1,2,3,4,5,6,7,8,9) mydist <- c(53.846154,15.384615,15.384615,7.692308,7.692308,0,0,0,0) basedist <- c(30.103,17.609126,12.493874,9.691001,7.918125,6.694679,5.799195,5.115252,4.575749) df <- data.frame(numb, mydist, basedist) ggplot(data=df,aes(x=numb)) + geom_bar(stat="identity", aes(y=mydist), colour="green", fill="green") + geom_line(aes(y=basedist,group=1, colour="base distribution")) + geom

AttributeError: Unknown property legend in seaborn

╄→гoц情女王★ 提交于 2020-01-11 08:06:08
问题 The seaborn stripplot has a function which allows hue . Using the example from https://stanford.edu/~mwaskom/software/seaborn/generated/seaborn.stripplot.html import seaborn as sns sns.set_style("whitegrid") tips = sns.load_dataset("tips") ax = sns.stripplot(x=tips["total_bill"]) ax = sns.stripplot(x="sex", y="total_bill", hue="day", data=tips, jitter=True) In this case, the legend is quite small, showing a different hue for each day. However, I would like to remove the legend. Normally, one

ggplot legend not working with scale_colour_manual

久未见 提交于 2020-01-11 05:46:09
问题 I know an identical question has been asked earlier. ggplot legend - scale_colour_manual not working But the question involves a somewhat complicated dataset than what I have here and the answer suggests restructuring data and then works with restructured data. But the problem persists even with simple data as I have below and I can't solve it. So please don't mark it as duplicate. The problem: when using scale_colour_manual in ggplot2, the legend is not showing. p <- data.frame(a = runif(10,

Concatenating 2D plots

情到浓时终转凉″ 提交于 2020-01-09 11:53:10
问题 I have several 2D-plots in MATLAB. In each plot there are some lines (each line is a row-vector of values of fixed length). There is always a base line (black one) and the remaining colored lines may or may not be present. , . I need to concatenate all such plots into one plot as shown below: Please note these are just for representational purpose but explain my problem well. I am not able to figure how to do it. Anybody got an idea? An example may be? Also, there has to be a vertical gap

Legend is apears in the wrong place in the page (R): not fully shown

我怕爱的太早我们不能终老 提交于 2020-01-07 09:51:46
问题 I have added the following command to the plot in R: df<- read.table("filename.csv", header=TRUE, sep=",", stringsAsFactors=FALSE) tdf=as.data.frame(df[2:ncol(df)]) # draw the plot bb<- barplot(as.matrix(tdf), beside=T , col=colours,border="black", ylim=c(0,100), ylab="Percentage (%)",xlab="Methods)") y<-as.matrix(tdf) text(bb,y+2,labels=as.character(y),pos =1,offset=3,cex = 0.6, col = "black") legend("topleft", c("M1","M2","M3","M4","M5", "M6"), cex=0.6,inset=c(1,0),xpd=TRUE, fill=colours)

Legend is apears in the wrong place in the page (R): not fully shown

Deadly 提交于 2020-01-07 09:51:10
问题 I have added the following command to the plot in R: df<- read.table("filename.csv", header=TRUE, sep=",", stringsAsFactors=FALSE) tdf=as.data.frame(df[2:ncol(df)]) # draw the plot bb<- barplot(as.matrix(tdf), beside=T , col=colours,border="black", ylim=c(0,100), ylab="Percentage (%)",xlab="Methods)") y<-as.matrix(tdf) text(bb,y+2,labels=as.character(y),pos =1,offset=3,cex = 0.6, col = "black") legend("topleft", c("M1","M2","M3","M4","M5", "M6"), cex=0.6,inset=c(1,0),xpd=TRUE, fill=colours)

How to add a legend in ggplot (not showing up)

我怕爱的太早我们不能终老 提交于 2020-01-07 08:25:56
问题 I'd like to add a legend where the red line = reject rate, dark blue = mean(reject_rate) and light blue = mean + 2 standard deviations I've got the lines plotted fine, but can't seem to get a legend to show up. Many thanks data > dput(sub) structure(list(Report_Date = structure(c(16311, 16318, 16325, 16332, 16339, 16346, 16353, 16360, 16367, 16374, 16381, 16388, 16311, 16318, 16325, 16332, 16339, 16346, 16360, 16367, 16374, 16381, 16388, 16311, 16318, 16325, 16332, 16339, 16346, 16353, 16360,