legend

How to create a legend with both color and shape

与世无争的帅哥 提交于 2019-12-06 14:36:32
问题 I have created a 4*2 experiment design(4 treatments and 2 repeats of each treatment) and wanted to use 4 shapes and 2 colors symbols to classify the 4*2 experiments in ggplot2. I have two legends, one for shapes and the other one for two colors, and I want to combine the two legends into a single legend. I have searched the post(Combine legends for color and shape into a single legend), but still have no idea to solve the problem. Thank you in advance! My data: x y Treatment Repeat 75

How to add legend below subplots in matplotlib?

久未见 提交于 2019-12-06 12:10:26
问题 I am trying to add a legend below a 3-column subplot figure. I have tried the following: fig, ax = plt.subplots(ncols=3) ax[0].plot(data1) ax[1].plot(data2) ax[2].plot(data3) ax_sub = plt.subplot(111) box = ax_sub.get_position() ax_sub.set_position([box.x0, box.y0 + box.height * 0.1,box.width, box.height * 0.9]) ax_sub.legend(['A', 'B', 'C'],loc='upper center', bbox_to_anchor=(0.5, -0.3),fancybox=False, shadow=False, ncol=3) plt.show() However, this creates just one empty frame. When I

ggplot and two different geom_line(): the legend does not appear

老子叫甜甜 提交于 2019-12-06 11:36:02
问题 I have the following code ( dput data for the data sets is here): ruz <- structure(list(date = structure(c(16617, 16618, 16619, 16622, 16623, 16624, 16625, 16626, 16629, 16630, 16631, 16632, 16633, 16636, 16637, 16638, 16639, 16640, 16643, 16644, 16645, 16646, 16647, 16650, 16651, 16652, 16653, 16654, 16657, 16658, 16659, 16660, 16661, 16664, 16665, 16666, 16667, 16668, 16671, 16672, 16673, 16674, 16675, 16678, 16679, 16680, 16681, 16682, 16685, 16686, 16687, 16688, 16689, 16692, 16693, 16694

Assigning color to the rectangle near legend items in wpf toolkit charting lineseries

你说的曾经没有我的故事 提交于 2019-12-06 11:19:01
I am adding lineseries to a chart dynamically as follows. foreach (KeyValuePair<string, List<KeyValuePair<DateTime, double>>> tempSeries in yieldSeries) { LineSeries lineSeries = new LineSeries(); lineSeries.DependentValuePath = "Value"; lineSeries.IndependentValuePath = "Key"; lineSeries.ItemsSource = tempSeries.Value; lineSeries.Title = tempSeries.Key; lineSeries.SetResourceReference(FrameworkElement.StyleProperty,"CommonLineSeries"); lineSeries.Tag = Brushes.Red; lineSeries.Background = Brushes.Red; yieldTrendChart.Series.Add(lineSeries); } I wish to assign specific color in specific order

One legend for all subplots in pyplot

岁酱吖の 提交于 2019-12-06 10:42:31
I am currently plotting the same data but visualizing it differently in two subplots (see figure): Code snippet used for producing the above figure: # Figure plt.figure(figsize=(14,8), dpi=72) plt.gcf().suptitle(r'Difference between TI and $\lambda$D', size=16) # Subplot 1 ax1 = plt.subplot2grid((1,3),(0,0),colspan=2) # Plot scattered data in first subplot plt.scatter(LE_x, LE_y, s=40, lw=0, color='gold', marker='o', label=r'$\lambda$D') plt.scatter(MD_x, MD_y, s=40, lw=0, color='blue', marker='^', label=r'TI') # Subplot 2 ax2 = plt.subplot2grid((1,3),(0,2)) plt.barh(vpos1, LE_hist, height=4,

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

烈酒焚心 提交于 2019-12-06 09:13:56
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 plotmaths commands for their use in legends? (without doing it manually) factor = 1e-5 alpha = 1:10 omega

Change the size of the text in legend according to the length of the legend vector in the graph

痞子三分冷 提交于 2019-12-06 08:21:26
I have to draw a 20 plots and horizontally place a legends in each plots. I gave the following command for the first plot: plot(x=1:4,y=1:4) legend("bottom",legend = c("a","b","c","d"),horiz=TRUE,text.font=2,cex=0.64) then for the second plot I tried : plot(x=1:2,y=1:2) legend("bottom",legend = c("a","b"),horiz=TRUE,text.font=2,cex=0.64) But because the size of the character vector passed to legend argument are different I get the size of the legend different. Since I have to plot so many different plots having varying sizes of legends,I would want to do it in an automated fashion. Is there a

is it possible to set the position of a label relative to the key in gnuplot?

浪尽此生 提交于 2019-12-06 05:38:24
问题 The nature of my plot is such that absolute labels don't really work; I can't restrict the range in y, so wondered if there was a way to either include my label text inside the key or have it placed relative to the key (i.e. below) set term png enhanced size 1024,768 set title "{/=15 1D My title}\n - by me" set xlabel "x" set ylabel "y" set label "V_0 = 10\n E = 1" #this is the bit I want to reposition set out 'trial.png' set xrange [-2.5:2.5] set arrow from -2,-2000 to -2,2000 nohead size

Highcharts: structure legend by subtitles

♀尐吖头ヾ 提交于 2019-12-06 05:00:22
I was playing around with Highcharts the last days. One thing, I couldn't find out, is if it is possible to include subtitles to the legend to structure the results. In my example: http://jsfiddle.net/gWEtB/ var allData={ products: ["Product1", "Product2", "Product3", "Product4"] } var colors={ 'own': ['#3B14AF', '#422C83', '#210672', '#886ED7'], 'comp': ['#E7003E', '#AD2B4E', '#960028', '#F33D6E', '#F36D91'], 'new': '#00CC00'} `$(function () { $('#container').highcharts({ chart: { type: 'column' }, title: { text: 'Product Switching' }, xAxis: { categories: allData.products }, yAxis: { min: 0,

R how to control spacing of colour bar/legend

和自甴很熟 提交于 2019-12-06 04:43:19
I'd like to plot a map of chlorophyll concentration, but the values are dispersed in such a way that the legend becomes unreadable (see picture) So I am trying to control the spacing of the colours in the colour bar/legend. I'd like to get it evenly spaced (while keeping the uneven breaks on the map itself). The the example below is much simplified and is for a raster plot, but the same goes for image.plot. library(raster) r <- raster(ncol=5, nrow=4) r[] <- 1:20 plot(r, breaks = c(0,1,2,3,5,10,20), col = rainbow(6)) I thought about converting the data to log values, but that doesn't give me a