legend-properties

Matplotlib automatic legend outside plot [duplicate]

南楼画角 提交于 2019-12-03 07:08:14
问题 This question already has answers here : How to put the legend out of the plot (16 answers) Closed 2 years ago . I am trying to use the keyword bbox_to_anchor() in a matplotlib plot in Python. Here is a very basic plot that I have produced: import matplotlib.pyplot as plt x = [1,2,3] plt.subplot(211) plt.plot(x, label="test1") plt.plot([3,2,1], label="test2") plt.legend(bbox_to_anchor=(0, -0.15, 1, 0), loc=2, ncol=2, mode="expand", borderaxespad=0) plt.show() It is based on the example here:

How can I control the placement of my Chart.JS pie chart's legend, as well as its appearance?

空扰寡人 提交于 2019-12-03 06:53:22
问题 I am able to create a pie chart using Chart.JS with this code: HTML <div> <canvas id="top10ItemsChart" style="padding-left:20px" width="320" height="320"></canvas> <div id="top10Legend" class="chart-legend"></div> </div> jQuery var data = [{ value: 2755, color: "#FFE135", label: "Bananas" }, { value: 2256, color: "#3B5323", label: "Lettuce, Romaine" }, { value: 1637, color: "#fc6c85", label: "Melons, Watermelon" }, { value: 1608, color: "#ffec89", label: "Pineapple" }, { value: 1603, color: "

Matplotlib automatic legend outside plot [duplicate]

陌路散爱 提交于 2019-12-02 20:40:57
This question already has answers here : How to put the legend out of the plot (16 answers) I am trying to use the keyword bbox_to_anchor() in a matplotlib plot in Python. Here is a very basic plot that I have produced: import matplotlib.pyplot as plt x = [1,2,3] plt.subplot(211) plt.plot(x, label="test1") plt.plot([3,2,1], label="test2") plt.legend(bbox_to_anchor=(0, -0.15, 1, 0), loc=2, ncol=2, mode="expand", borderaxespad=0) plt.show() It is based on the example here: http://matplotlib.org/users/legend_guide.html#plotting-guide-legend I am trying to automatically place the legend outside

How can I control the placement of my Chart.JS pie chart's legend, as well as its appearance?

你离开我真会死。 提交于 2019-12-02 20:30:44
I am able to create a pie chart using Chart.JS with this code: HTML <div> <canvas id="top10ItemsChart" style="padding-left:20px" width="320" height="320"></canvas> <div id="top10Legend" class="chart-legend"></div> </div> jQuery var data = [{ value: 2755, color: "#FFE135", label: "Bananas" }, { value: 2256, color: "#3B5323", label: "Lettuce, Romaine" }, { value: 1637, color: "#fc6c85", label: "Melons, Watermelon" }, { value: 1608, color: "#ffec89", label: "Pineapple" }, { value: 1603, color: "#021c3d", label: "Berries" }, { value: 1433, color: "#3B5323", label: "Lettuce, Spring Mix" }, { value:

how to show legend items of patches in bokeh

穿精又带淫゛_ 提交于 2019-12-02 18:37:52
问题 In the following set up, I create a area chart based on the basic example. How do I get the legend for my input automatically or even programatically. For now I get only legend with one item 'a' and the first color. from bokeh.plotting import * ... patches([x2 for a in areas], list(areas.values()), color=colors, alpha=0.8, line_color=None, legend='a', title="hello chart") legend().orientation = "top_right" # what other options, may here? show() What is the format to pass into patches for the

how to show legend items of patches in bokeh

非 Y 不嫁゛ 提交于 2019-12-02 08:12:51
In the following set up, I create a area chart based on the basic example. How do I get the legend for my input automatically or even programatically. For now I get only legend with one item 'a' and the first color. from bokeh.plotting import * ... patches([x2 for a in areas], list(areas.values()), color=colors, alpha=0.8, line_color=None, legend='a', title="hello chart") legend().orientation = "top_right" # what other options, may here? show() What is the format to pass into patches for the legend as value or how can I trigger the legend() to show an item and color for every item in the plot?

How to increase marker size of the legend in scatter plot in MATLAB 2014b? [duplicate]

你。 提交于 2019-12-01 04:00:04
问题 This question already has an answer here : Change legend line style (1 answer) Closed 4 years ago . I found marker size in the scatter plot and the legend is different in MATLAB 2014b. I searched & found some solution from earlier version of MATLAB, which are not applicable in the latest version. In my current version, the marker size in legend is so small that it is hardly distinguishable. Any help? figure; hold on s1 = scatter(1, 1, 150, 'k', 'o') s2 = scatter(1, 2, 150, 'k', '+') s3 =

Overlay base R graphics on top of ggplot2

ε祈祈猫儿з 提交于 2019-11-30 18:14:49
问题 I have a plot in ggplot and I wish to overlay a map legend that I have created with base R code. I do not know how to overlay base R graphics on top of a ggplot and would be grateful for assistance. Currently I have a ggplot legend that looks like this: There are several things that I do not like about this legend that I would like to change (and that resulted in me thinking it would be easier to resort to base R graphics to do so). In particular, I wish to eliminate the white space between

Multicolor scatter plot legend in Python

大兔子大兔子 提交于 2019-11-29 15:52:13
I have some basic car engine size, horsepower and body type data (sample shown below) body-style engine-size horsepower 0 convertible 130 111.0 2 hatchback 152 154.0 3 sedan 109 102.0 7 wagon 136 110.0 69 hardtop 183 123.0 Out of which I made a scatter plot with horsepower on x axis, engine size on y axis and using body-style as a color scheme to differentiate body classes and. I also used "compression ratio" of each car from a seperate dataframe to dictate the point point size This worked out well except I cant display color legends for my plot. Help needed as i'm a beginner. Here's my code:

Multicolor scatter plot legend in Python

喜欢而已 提交于 2019-11-28 09:49:03
问题 I have some basic car engine size, horsepower and body type data (sample shown below) body-style engine-size horsepower 0 convertible 130 111.0 2 hatchback 152 154.0 3 sedan 109 102.0 7 wagon 136 110.0 69 hardtop 183 123.0 Out of which I made a scatter plot with horsepower on x axis, engine size on y axis and using body-style as a color scheme to differentiate body classes and. I also used "compression ratio" of each car from a seperate dataframe to dictate the point point size This worked