Skip to main content

All Questions

3 votes
1 answer
216 views

Adjusting colorbar legend limits

I have the following python code to plot a surface contour plot: import matplotlib.pyplot as plt from matplotlib import cm import pandas as pd dx = {'1': 1, '2': -1, '3': -1, '4': 1, '5': 0} x = pd....
Ram's user avatar
  • 33
3 votes
0 answers
180 views

How do I change de size of the legend with matplotlib? and identify the states on my map

I have made this code for an activity, I am a beginner in python. But when I plot, the legend only shows the first letter of my legend. Also, this map shows a group of states and I would like to know ...
Daniele Ingredy's user avatar
1 vote
2 answers
931 views

Matplotlib subplots how to align colorbars with other legends, or how to justify subplots to left

How can I add a colorbar scale to the 2nd & 3rd subplots, such that it is inline with my legends in the 1st and 4th subplots? Or, another way to say the question: how can I add a colorbar scale ...
a11's user avatar
  • 3,326
1 vote
1 answer
615 views

matplotlit colorbar title hangs outside figure

What is the best way to specify my colorbar legend location while ensuring the legend title is within the figure? Sometimes the location will be upper right, as shown here; but in other plots it will ...
a11's user avatar
  • 3,326
2 votes
1 answer
3k views

LEGEND in a 3D bar plot as a colormap

I have a 3D bar plot in matplotlib which consists of a total 40 bars and at the moment it is quite confusing.I converted my data array to an array of colors using a colormap. colors = plt.cm.jet(data....
Dreamer's user avatar
  • 25
0 votes
1 answer
3k views

How to customize colorbar in Seaborn Heatmap with text labels [duplicate]

I'd like to create a colorbar legend for a heatmap, that instead of numbers has text. For example, suppose I am going to show the people distribution who traverse between some cities. But in ...
samie's user avatar
  • 179
3 votes
1 answer
4k views

How to remove legend from an image plot

I am trying to remove the legend of the spectrogram (I am trying to get a 244x244 pixel image) I have tried Remove the legend on a matplotlib figure but it works in a very weird way - I get the result ...
Pradyumna's user avatar
  • 525
1 vote
0 answers
321 views

Colorbar/Legend options when overlaying tricontour plots

I have created three tricontour plots and have overlayed these plots as shown below: finalDf = pca_cont('%_helix') x1 = list(finalDf['pc1']) y1 = list(finalDf['pc2']) z1 = list(finalDf['%_helix']) ...
Haj Sai's user avatar
  • 311
1 vote
1 answer
1k views

how to customize color legend when using for loop

I want to draw a 3D scatter, in which the data is colored by group. Here is the data sample: aa=pd.DataFrame({'a':[1,2,3,4,5], 'b':[2,3,4,5,6], 'c':[1,3,4,6,9], ...
Feng Chen's user avatar
  • 2,213
6 votes
2 answers
11k views

Add colorbar as legend to matplotlib scatterplot (multiple subplots, multiple scatters)

I have several subplots to which I want to add a single colorbar. Each subplot consists of 7 scatters. I found advise on how to add colorbars, but they are mostly related to the value of each scatter-...
offeltoffel's user avatar
  • 2,791
0 votes
1 answer
321 views

How to plot legend with diff color correspond to diff value in matplotlib python?

I am trying to plot subarea of landuse dataset, I want to get a legend like in the picture. I am using plt.imshow() to plot img, the input is 2D array, the value of array is land use code. How can I ...
shi's user avatar
  • 11
0 votes
1 answer
2k views

adding legend in pcolor with cs.cmap.set_under and .set_over

I have googled how to set legends in matplotlib pcolor, but I am still unsure and have not found references to how to set a legend for the specific colors I have set to .set_under and .set_over Is ...
pwprnt's user avatar
  • 561
2 votes
1 answer
3k views

Show a (discrete) colorbar next to a plot as a legend for the (automatically chosen) line colors

I tried to make a plot showing many lines, but it is hard to tell them apart. They have different colors, but I would like to make it easy to show which line is which. A normal legend does not really ...
user9216538's user avatar
1 vote
1 answer
943 views

Python matplotlib: How to tick and ticklabel an axis/object independently of the object's scale

The following code defines a rectangular region in a figure and draws a color bar based on a color map in it. I've changed the color bar's scaling to the cubic root of its original, but I wish the ...
hafniate's user avatar
2 votes
1 answer
2k views

Matplotlib Colorbar Display Digtis

How do I exactly specify the colorbar labels in matplotlib? Frequently, I need to create very specific color scales, but the colorbar labels display so poorly you can't tell what the scale is. I would ...
john_science's user avatar
  • 6,473

15 30 50 per page