legend

Bokeh: Legend outside plot in multi line chart

Bokeh: Legend outside plot in multi line chart Question: I have a multi line plot in Bokeh: import pandas as pd from bokeh.plotting import figure, show from bokeh.palettes import Category20c_7 from bokeh.io import output_file from bokeh.models import SingleIntervalTicker, LinearAxis, ColumnDataSource output_file("conso_daily.html") treatcriteria_daily_data = pd.read_csv("treatcriteria_evolution.csv", sep=’;’) final_daily_data = treatcriteria_daily_data.groupby([‘startdate_weekyear’,’startdate_dayweek’],as_index = False).sum().pivot(‘startdate_weekyear’,’startdate_dayweek’).fillna(0) # keep only integer values …

Total answers: 2

Moving marker position inside legend

Moving marker position inside legend Question: I have a plot in which I need information encoded in line-style, color and markers. However, when I create a legend, the markers cover a significant part of the lines, resulting in poorly recognizable line-styles. Example: Is it possible to move the markers to the side (left or right), …

Total answers: 1

Getting coordinates of legend markers

Getting coordinates of legend markers Question: It’s my first time asking a question here. So please tell me if anything is amiss. So I’m trying to create a dataset of synthetically generated charts to train a neural net to find bounding boxes for different elements of a chart – legend box, chart title, axes labels, …

Total answers: 1

How to change legend position in kdeplot

How to change legend position in kdeplot Question: I try to change kdeplot legend position. unfortunelly position is changed but contents is not showing. outline only. My code is: import pandas as pd import seaborn as sns import matplotlib.pyplot as plt df=pd.read_excel(‘mydata.xlsx’,sheet_name=0) ax=sns.kdeplot(data=df,x="c",hue="scan",shade=True,palette="deep",legend=False) ax.legend(loc=’upper left’, bbox_to_anchor=(0.25, 0.75)) plt.show() anboy help me~ Asked By: justice V …

Total answers: 1

Secondary axis multiple legends

Secondary axis multiple legends Question: I have a plot that has a secondary axis. Axis 1 has two data sets plotted against it. Axis 2 has one data set. I can get two legends (one from Axis 1 and one from Axis 2) like how I want them – one below the other outside the …

Total answers: 2

Python matplolib legend how to reduce distance between frame left edge and markers

Python matplolib legend how to reduce distance between frame left edge and markers Question: As question suggests, I’m trying to reduce the distance between the left edge of the legend frame and the markers. In figure there is the current plot. I would like to find a way to: keeping the frameon = True in …

Total answers: 3

Edit legend title of Seaborn scatterplot and countplot

Edit legend title of Seaborn scatterplot and countplot Question: I am using seaborn scatterplot and countplot on titanic dataset. Here is my code to draw scatter plot. I also tried to edit legend label. ax = seaborn.countplot(x=’class’, hue=’who’, data=titanic) legend_handles, _ = ax.get_legend_handles_labels() plt.show(); To edit legend label, I did this. In this case, there …

Total answers: 2

How to remove legend from an image plot

How to remove legend from an image plot Question: I am trying to remove the legend of the spectrogram (I am trying to get a 244×244 pixel image) I have tried Remove the legend on a matplotlib figure but it works in a very weird way – I get the result and an exception! (I …

Total answers: 1

No handles with labels found to put in legend

No handles with labels found to put in legend Question: I’m trying to create a parallelogram in PyPlot. I’m not up to drawing the parallelogram–first I’m putting in the vector arrows–using the following code: fig = plt.figure() ax = fig.add_subplot(111) ax.spines[‘left’].set_position(‘zero’) ax.spines[‘right’].set_color(‘none’) ax.spines[‘bottom’].set_position(‘zero’) ax.spines[‘top’].set_color(‘none’) plt.axis([-5,5,-5,5]) ax.xaxis.set_ticks_position(‘bottom’) ax.yaxis.set_ticks_position(‘left’) plt.grid() plt.arrow(0,0, 3,1, head_width=0.2, color=’r’, length_includes_head=True, label=’u’) plt.arrow(0,0, …

Total answers: 7