Skip to main content

All Questions

Tagged with
0 votes
1 answer
175 views

Adjust spacing between 2 markers of same line displayed in the legend of matplotlib plot

I am plotting 2 markers of the same line using the following code and I want to adjust the spacing between two markers in the legend. Code : ref. import matplotlib.pyplot as plt from matplotlib....
Natasha's user avatar
  • 1,431
0 votes
1 answer
608 views

GeoPandas | Legend not showing

Goal: Show legend I've set legend=True and no difference was made. for i in list(range(NUM_SLIDES)): d = {'col1': ['Foo', 'Bar', 'Sue'], 'geometry': [foo[i], bar[i], sue[i]]} gdf = gpd....
DanielBell99's user avatar
  • 1,541
0 votes
1 answer
107 views

Removing legend duplicates leaves unmatched colors between the legend and the lines (matplotlib, python)

I have multiple .dat files looking like this: first file and second file . Firstly, I used this code: z_bins = 541 h_bins = 65 for nr in [1,2]: array = [] profile = "file_{}.dat"....
HungryMolecule's user avatar
0 votes
1 answer
298 views

Hiding Bokeh glyphs based on categorical data with color_mapper

Currently i found a way of plotting my categorical data by using the color_mapper and the legend_field variable. My data look the following way: df_plot x y category 0 91....
Maxi Trien's user avatar
0 votes
0 answers
941 views

Fancybox is not working. What am I doing wrong?

I was following an example from Python Data Science Handbook which is plotting a simple graph. Its supposed to use fancybox on labels but it is not working as per the example. The code is: x = np....
omsinghml's user avatar
0 votes
1 answer
93 views

How to make a legend in a plot?

I am unable to figure out a way to get a legend of my plot. My data is a data frame consisting of 3 columns x, y and z. x and y represent the co-ordinates of a point and z is the label(0,1,2,3) that ...
Akhilesh Sharma's user avatar
18 votes
1 answer
29k views

Sharing same legends for subplots in plotly

I've two plots created in the same figure using subplots in plotly. import plotly.graph_objects as go import numpy as np import pandas as pd from plotly.subplots import make_subplots df = pd....
Natasha's user avatar
  • 1,431
2 votes
1 answer
170 views

How to modify scatter-plot figure legend to show different formats for the same types of handles?

I am trying to modify the legend of a figure that contains two overlayed scatter plots. More specifically, I want two legend handles and labels: the first handle will contain multiple points (each ...
user avatar
0 votes
0 answers
58 views

Issue with legend and x label

I have almost a nice plot but there are issues. The first one: x label doesn't show up. The second issue: I can't put the name of second line in legend. I have only one name (Close) and I need also '...
Tmiskiewicz's user avatar
4 votes
2 answers
6k views

How to add a legend entry without a symbol/color into an existing legend?

I have a plot with a legend. I would like to add an entry into the legend box. This entry could be something like a fit parameter or something else descriptive of the data. As an example, one can ...
user avatar
3 votes
3 answers
8k views

bokeh add legend to Step graph

How can I add a legend to lines in Step graph example for bokeh: https://docs.bokeh.org/en/latest/docs/reference/models/glyphs/step.html I would like to have legend in 'top right' corner of plot for ...
Admed's user avatar
  • 71
6 votes
1 answer
3k views

Centering matplotlib legend entries within incomplete/unfilled rows?

Say I'm making a plot with five items, and only have room to create a legend with 3 columns (more columns than this would be too wide), e.g. import matplotlib.pyplot as plt fig, ax = plt.subplots() ...
Luke Davis's user avatar
  • 2,606
5 votes
1 answer
6k views

How do I show legend for different colors in bokeh scatter plot?

This is my plot. I need to show the legend for the different colors used. How do I do that? My code for the plot: def mscatter(p, x, y, c,typestr,source): p.scatter(x, y, marker=typestr, ...
n00b's user avatar
  • 1,599
0 votes
1 answer
651 views

Empty square for legend for stackplot

I'm trying to generate a stack plot of version data using matplotlib. I have that portion working and displaying properly, but I'm unable to get the legend to display anything other than an empty ...
thegrinner's user avatar