Questions tagged [colorbar]
Questions that include the use and customization of colorbars in figures
1,120
questions
0
votes
0
answers
15
views
Two colorbars in a single R plotly scatter plot
I think I'm basically looking for an R plotly equivalent to this python plotly post:
I have a XY data.frame that I'd like to plot using R's plotly, where each point belongs to either one of two types (...
-1
votes
0
answers
32
views
Put a gradient color bar with scatter in python
I have a color bar but it's not gradient... Here's my code
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
data1 = pd.read_csv('uchuugals_11.8.txt', sep='\s+', header=None)
...
0
votes
2
answers
32
views
How do I apply a colormap between minimum and maximum pixel values in image?
I have an 8-bit image ('Example_image.tif') that I would like to pseudo-color using custom RGB values from a .csv file ('Pseudocolor_sheet.csv'). The colormap is for pixel values between 0 and 255, ...
0
votes
1
answer
29
views
Bokeh: how to custom scale of ColorBar?
I make a figure (empty to simplify the code but I will add many elements), and a ColorBar to designate the color of different elements.
from bokeh.models import LinearColorMapper, ColorBar, ...
1
vote
2
answers
40
views
Bokeh colorbar, assign a tick to each color
I'm trying to plot an heatmap of a matrix containing some counts (called mat in my code, then df after change the structure to use it with Bokeh). The structure is like this:
X
element 1
element 2
...
0
votes
0
answers
23
views
Create a discrete colorbar for integer values
I have a question and hope someone can help me out with this one:
I would like to create a colorbar like in the picture below (the picture was created in PowerPoint , so code behind it). The idea is ...
1
vote
1
answer
21
views
How to hide, or at least customize colorbar in plotly scattergeo in R
I want to create a scattergeo plot with markers for capitals. These markers are sized and colored regarding database values.
If I use the standard colors, everything goes well : the map is shown ...
0
votes
1
answer
31
views
matplotlib colorbar extend in different color
I have data in a 2D matrix I want to plt.colorbar(extend = "both"), I have set my data to be maxed at 100 and mined at -100, now I want to see where my data is more than 100 (it's a ...
1
vote
2
answers
32
views
Plot 3d points (x,y,z) in 2d plot with colorbar
I have computed a lot (~5000) of 3d points (x,y,z) in a quite complicated way so I have no function such that z = f(x,y). I can plot the 3d surface using
import numpy as np
import matplotlib.pyplot as ...
1
vote
0
answers
26
views
xarray's scaling exponent is overlapping with the extended colorbar, how to shift the location of the displayed colorbar scaling exponent?
In the below example, the extend option is enabled which then leads to the tip of the extended colorbar to be behind the exponent indicating the scaling of the values in the colorbar.
Which with a ...
0
votes
1
answer
32
views
How to overwrite the colour scale when there are multiple colour scales?
I'm plotting 32 different lines, and these lines are separated into 3 different groups according to pillarType column in the dataset. Then for each group of curves, I'm using a different colour scale ...
0
votes
1
answer
20
views
Plot a custom colormap next to iterative scatterplot
I have a set of coordinates that are arranged per year, and I scatterplot them.
I create a custom colormap that reflects those years, but the issue is I can't manage to plot the colorbar of that ...
0
votes
1
answer
33
views
Pcolormesh plot with colorbar such that colors correspond to strings
Suppose I have four objects ('strings', can assign numbers to them (say, [0,2,4,6]) which I want to plot using pcolormesh with 4 colors representing the 4 string,, and even one string is missing from ...
2
votes
1
answer
24
views
Custom Spacing for colors in discrete colorbar
Essentially, I want to make my discrete, binary, colorbar in python matplotlib/seaborn to have custom spacing, so that one color takes up more of the color bar than the other.
I am using seaborn ...
0
votes
1
answer
15
views
How do I make non-continuous colorbar in matplotlib?
Using matplotlib, I want to make a colorbar like the one pictured here:
I want my colorbar to basically jump from 0 to 65/-65, then go linearly up to 100/-100. In other words, I want 65/-65 to be the ...
0
votes
0
answers
29
views
How to add a scale colorbar to Cartopy map?
I have created a Cartopy map plot using the following code:
lon = precip_full1.variables['longitude'][:]
lat = precip_full1.variables['latitude'][:]
precip_full1 = xr.open_dataset('era_yr1979.nc')
...
1
vote
1
answer
106
views
set custom tick labels on heatmap color bar
I have a list of dataframes named merged_dfs that I am looping through to get the correlation and plot subplots of heatmap correlation matrix using seaborn.
I want to customize the colorbar tick ...
2
votes
1
answer
33
views
How to customize the colorbar of a heatmap in seaborn?
Background: I compared the performance of 13 models by using each of them for prediction over four data sets. Now I have 4 * 13 R-Squared values which indicate the goodness of fit. The problem is that ...
0
votes
1
answer
36
views
How can I create a colored histogram in plotly?
I'm trying to figure out how to build a histogram with color bar similar to the figure below using plotly.
3
votes
1
answer
38
views
Matplotlib colorbar does not draw edges at extremities
When creating a matplotlib colorbar, it is possible to set drawedges to True which separates the colors of the colorbar with black lines. However, when the colorbar is extended using extend='both', ...
0
votes
0
answers
51
views
Matplotlib 3D: place colorbar into z-axis
I have a matplotlib 3d plot, like the one from the examples in the documentation
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib....
0
votes
1
answer
25
views
Barplot in Ggplot2: Auto-customized Colour Using R According to the Value of a Column
I want the colour in this barplot to be automatically filled with the minimum figure in RMSE column to be greenthe nest to the minimumRMSEfigures to beyellowgreenthe middle figure to beyellow, the ...
0
votes
2
answers
64
views
How to make colormap of this colorbar image attached?
0
I want to make a colormap used in the attached image.
img = imread('/path/Screenshot 2022-04-12 at 2.14.16 PM.png')
colors_from_img = img[:, 0, :]
my_cmap = LinearSegmentedColormap.from_list('...
0
votes
1
answer
40
views
limit range of colorbar on bar graph in matplotlib
I've been attempting to limit the range on the colorbar function in matplotlib. For whatever reason, I cannot use the clim function. Ideally I would like 80 and 20 to be the max values of the colorbar,...
0
votes
0
answers
12
views
set colorbar scale / limits
I have a plot with an aberrant scale on colorbar compared to the frequency of interest. I would like to change at least the max and min values of the colorbar. How can I do that ? I did not found the ...
1
vote
1
answer
27
views
How to add colorbar to existing axis handle?
This way is easy and works:
plt.imshow(im)
plt.colorbar()
But when it's like this:
f,ax = plt.subplots(3,1)
ax[2].imshow(im)
How do I get the colorbar on that axis? I don't need anything fancy, just ...
0
votes
0
answers
45
views
quiverkey reference vector is missing in matlpotlib plot
I am plotting moisture flux transport with the help of quiver. I am plotting a panel plot with 12 plots in it. I want to show the magnitude corresponding to the reference vector outside of the plot ...
0
votes
0
answers
55
views
Matplotlib Imshow Showing the Wrong Colours on Update
I'm trying to make a heatmap over time, but I think matplotlib is messing with the plot colours.
My code is based on the heat equation, I think the specs are not important, the main thing is that I am ...
3
votes
1
answer
96
views
using PyPlot in Julia 1.7: colorbar & equal 3D axis
I'm updating the syntax for julia 1.7. I have everything below working for julia 0.x, and below represents all I found for 1.7, but there are still glitches.
Question 1. How do I get the colorbar to ...
1
vote
0
answers
34
views
How to "cut" Colorbar in subplot Matplotlib python
I am trying to normalize a colorbar (-350,350) and than plot in an subplot of the figure.
Now I am doing this:
cmap= cmocean.cm.balance
ax3 = fig.add_subplot(spec[2])
cmap =cmocean.cm.balance
norm1 = ...
0
votes
0
answers
27
views
Colorbar scale wrong on Octave
I try to create a graph in which there is a line with colour based on a third variable.
To do that, I'm using scatter plot.
When I add colorbar to this plot, the data range reported on the colorbar ...
1
vote
2
answers
92
views
How to avoid multiple colorbars when looping seaborn heatmap
I made 3 plots in a for loop with the following code. But the first figure I create has 3 colorbars, the 2nd has 2 and the 1st has 1. So it seems the previous plot adds a colorbar to the current plot. ...
0
votes
0
answers
28
views
Different colors for each bar
I have this data:
x=file.variable %file text (ABR CAM CAL BAS EML...etc)
y=file.variable %number (12 52 32 36 59....etc
z=file.variable %number (2.3 5.4 8.3 1.3....etc)
[~,arr] = sort(z,'ascend'); %...
0
votes
0
answers
17
views
matplotlib - set correct colorbar as for plot and colorbar number labels to correspond to real data range [duplicate]
In the example code below, I am colorizing the data points of a sinus plot according to the values of the third data column (z).
Now I would like to plot a colorbar with the corresponding chosen color ...
0
votes
0
answers
7
views
Thick line intersection in colorbar
I plot the Colorbar but, I have thick line intersection between Colorbar and bounds.
Do you have any idea for remove it or make it less thick?
bounds = [-0.9,-0.7,-0.5,-0.3,-0.1,0.1,0.3,0.5,0.7,0.9]
...
0
votes
0
answers
25
views
How to set the position of colorbar tiks label to the center
I'm plotting some discrete data, and each color represents a class, and I would like the class(number) to be in the center of each color at the colorbar.
How can I do that? How can I set the position ...
0
votes
0
answers
7
views
How can I determine the values shown on a spectrograph colorbar?
I am trying to make sure that a bunch of different spectrographs I am trying to produce have the same colorbar scale so I can compare them. This is the code I have so far:
for tr in traces:
#fig = ...
0
votes
0
answers
15
views
Can I add certain colors to bar graphs in order to illustrate frequency of the data point on octave?
I would like to customize my histogram to show an array of colors that refer to the frequency of that value. Essentially, if there are 6 times a value appears I would like it to be bright red, vs 2 ...
1
vote
1
answer
56
views
Positioning Multiple Colorbars outside of Subplots (matplotlib)
I have a figure with multiple subplot rows that all share an x axis.
Some of the rows require a color bar, but the other rows don't.
If I just use the color bar function, the subplots will be ...
2
votes
1
answer
58
views
X-axis label doesn't show on Pandas DataFrame plot with colorbar
I want to make a pandas.DataFrame.plot with colorbar. For reproducibility, here I use the code in this post on stack overflow.
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
...
0
votes
1
answer
90
views
how to create a colormap and a colorbar with discrete values in python?
I want to build a colormap and a colorbar with specific values for a map of accumulated rainfall, as shown in the image:
enter image description here
This is the function that I have that graphs the ...
0
votes
0
answers
41
views
Make colorbar legend smaller
Is there a way to make this colorbar legend way smaller ? Like 1/5th or 1/10th of its current size so it blends in better ?
I don't know how much of the code you need to see so here is everything:
...
1
vote
1
answer
72
views
Geopandas plot makes label for every datapoint instead of a colorbar
This is my simple code:
gdf_MA_outage.plot(column = 'total_customers_affected_by_city' , cmap = 'OrRd' , figsize = (16,16) , legend = True)
'total_customers_affected_by_city' ranges from 1 to 200000. ...
0
votes
0
answers
33
views
Create color scale with 2 basis with Matplotlib?
Desired Result Hi guys Im trying to visualise color scale bar with two colors where the middle point should be darker and it should go brighter at the end. The code is below I suppose a have to make ...
0
votes
0
answers
41
views
Colorbar broken when using LogNorm
The colorbar in the lastest matplotlib version (3.5.2) does not seem to detect when one is using a logarithmic scale.
See this code example:
import numpy as np
import matplotlib.pyplot as plt
from ...
0
votes
0
answers
61
views
How to edit the colorbar in Matplotlib so that it splits on a specific color plus a colormap?
I have x, y, z data plotted with contourf.
My z values varies in this interval (0, 3.6).
I want that all the z values <0.35 are colored in blue (for example, blue(Safe 16 SVG Hex3) #0000FF), and ...
0
votes
0
answers
41
views
Colorbar line plot of multiple lines according to a third variable value
Dataset: I have a series (n = 30) of X (wavelength) and Y (reflectance) data, each associated with a unique value Z (age). Z values are stored as a separate ordered list.
Goal: I am trying to create a ...
0
votes
0
answers
30
views
Colorbar size on Octave
I'm trying to set the colorbar size on a figure printed on pdf, but doesn't work.
there are the rows of my code:
figure(1, "paperunits", "centimeters", "papertype", "...
0
votes
2
answers
86
views
how to instantly update the colorbar range of a matplotlib from values of entries?
I have a simple code to plot a figure. I want to manually change the range for the colorbar.
So, I added two Entries and defined a second function change(). I want to make this change for the colorbar ...
0
votes
1
answer
44
views
How to display broader range of colors in colorbar than in image in Bokeh
Problem:
I am trying to plot several images in Bokeh with the exact same colorbar. But it seems to be impossible.
In this minimal example, even if I set the same values low and high for the 2 color ...