legend

Is it possible in chartjs to hide certain dataset legends?

一笑奈何 提交于 2020-05-10 07:04:37
问题 Is it possible to only hide certain dataset legends in chartjs? I know it is possible to hide all with options: { legend: { display: false 回答1: Short answer: Yes it is possible. Unfortunately it's not quite as simple as the developers could make it. If you know what the text value of the item being displayed in the legend is, then you can filter that out. After reading through the Chart.js docs I found the section Legend Label Configuration that details a filter function that can be used to

Cannot remove grey area behind legend symbol when using smooth

笑着哭i 提交于 2020-05-09 05:49:04
问题 I'm using ggplot2 with a GAM smooth to look at the relationship between two variables. When plotting I'd like to remove the grey area behind the symbol for the two types of variables. For that I would use theme(legend.key = element_blank()) , but that doesn't seem to work when using a smooth. Can anyone tell me how to remove the grey area behind the two black lines in the legend? I have a MWE below. library(ggplot2) len <- 10000 x <- seq(0, len-1) df <- as.data.frame(x) df$y <- 1 - df$x*(1

Is it possible to add custom shapes ( from png) to ggplot legend?

若如初见. 提交于 2020-04-30 06:29:39
问题 I was wondering whether it is possible to add shapes to the legend for ggimage() . I found similar questions, but they either have 1) same picture with a different color in legend, or 2) same picture different colors. I used this link to add images to the legend that have color, but i can't figure out how to edit it so that image will be different. I tried this, but I am not advance enough to adjust the code to fit my case d <- data.frame(x = rnorm(10), y = rnorm(10), image = sample(c("https:

How to get legend location in matplotlib

[亡魂溺海] 提交于 2020-04-13 11:07:51
问题 I'm trying to get the legend location in matplotlib. It seems like Legend.get_window_extent() should provide this, but it returns the same value regardless of where the legend is located. Here is an example: from matplotlib import pyplot as plt def get_legend_pos(loc): plt.figure() plt.plot([0,1],label='Plot') legend=plt.legend(loc=loc) plt.draw() return legend.get_window_extent() if __name__=='__main__': # Returns a bbox that goes from (0,0) to (1,1) print get_legend_pos('upper left') #

How to prevent the legend from updating in R2017a and newer?

陌路散爱 提交于 2020-04-06 03:48:33
问题 Since MATLAB R2017a, figure legends update automatically when adding a plot to axes. Previously, one could do this: data = randn(100,4); plot(data) legend('line1','line2','line3','line4') hold on plot([1,100],[0,0],'k-') to plot four data lines with a legend, and then add a black line for y=0. However, since R2017a, this leads to the black line being added to the legend, with the name "data1". How do I prevent this line from being added to the legend, so that the code behaves like it did in

How to prevent the legend from updating in R2017a and newer?

不羁的心 提交于 2020-04-06 03:47:48
问题 Since MATLAB R2017a, figure legends update automatically when adding a plot to axes. Previously, one could do this: data = randn(100,4); plot(data) legend('line1','line2','line3','line4') hold on plot([1,100],[0,0],'k-') to plot four data lines with a legend, and then add a black line for y=0. However, since R2017a, this leads to the black line being added to the legend, with the name "data1". How do I prevent this line from being added to the legend, so that the code behaves like it did in

matching line colors to legend when plotting data from multiple arrays

跟風遠走 提交于 2020-03-25 16:02:44
问题 I have temperature data from multiple devices on different boards, for example, on board 1 I have temperature for the PCB itself, and 3 different FETs, and similarly for boards 2 and 3. I read the data into a dataframe, and want to plot the data together with the same color for each board tested, but with different markers for each of the devices on the boards. For example, all the measurements from board 1 would be blue, with the PCB temp using marker '+', FET1 using marker 'v' etc. I read

Leaflet: how can I display a marker or legend only on one layer?

一世执手 提交于 2020-03-23 08:05:54
问题 I made a leaflet map with different layers which look like this: L.easyButton('<span class ="buttons">Example </span>', function (btn, map) { if (map.hasLayer(example1)) { map.removeLayer(example1); }; if (map.hasLayer(example2)) { map.removeLayer(example2); }; if (map.hasLayer(example3)) { map.removeLayer(drittpa2017zweit); } map.addLayer(example4); }, 'FirstExample').addTo(map); and so on... I declared a legend, which I only want to use when one layer is on, right now it appears all the

How to add legend to ggplot2 line with point plot?

浪子不回头ぞ 提交于 2020-03-23 08:01:09
问题 I have tried many codes, but always fail to add legend for the graph.I want to add legend for measured red point and simulated black lineThe graph is still missing legend with the code below library(foreign) library(ggplot2) library(dplyr) library(readxl) library(scales) Sys.setlocale("LC_TIME", "English") X0_40cm <- read_excel("C:/Users/Connie/Desktop/LAI/Wheat_2017-2018.xlsx") View(X0_40cm) ggplot(X0_40cm, aes(Date,LAI,group=1))+ geom_point(data=subset(X0_40cm, Condition=="Measured"),col=

Getting an object in Python Matplotlib

做~自己de王妃 提交于 2020-02-23 08:10:43
问题 To make a plot, I have written my code in the following fashion: from pylab import * x = [1,2,3] y = [1,2,3] matplotlib.pyplot.scatter(x,y,label='Blah') matplotlib.pyplot.legend(title='Title') matplotlib.pyplot.show() I want to change the font size of the legend title. The way to go about this is to get the legend object and then change the title that way (e.g., How to set font size of Matplotlib axis Legend?) Instead of rewriting all my code using ax.XXX, figure.XXX, etc, is there any way to