visualization

How to rearrange and set color in a nested pie plot

How to rearrange and set color in a nested pie plot Question: I am trying to draw a graph like this: The dataset is: Console Type Company Release Units_sold 0 PlayStation 2 Home Sony 2000 155000000 1 Nintendo DS Handheld Nintendo 2004 154002000 2 Nintendo Switch Hybrid Nintendo 2017 122550000 3 Game Boy Handheld Nintendo …

Total answers: 3

How to extract colors from branca colormap using Python?

How to extract colors from branca colormap using Python? Question: From the below branca colormap import branca color_map = branca.colormap.linear.PuRd_09.scale(0, 250) colormap = color_map.to_step(index=[0, 10, 20, 50, 70, 90, 120, 200]) How can I extract hex colours for all the steps(index) from the above Branca colormap? Asked By: Ailurophile || Source Answers: The source code …

Total answers: 2

Pandas bar plot ignores the xlim parameter

Pandas bar plot ignores the xlim parameter Question: I would like to only make a plot with only the year between 1990 and 2000. import random import pandas as pd df = pd.DataFrame({‘year’:range(1950,2020), ‘value’:[random.randint(100, 1000) for x in range(70)]}) df.plot(kind = ‘bar’, x = ‘year’, y =’value’, xlim = (1990,2000)) Whatever I set the value …

Total answers: 1

How can I create a plot to visualize the 68–95–99.7 rule?

How can I create a plot to visualize the 68–95–99.7 rule? Question: I’ve created a plot of normal distribution like this: fig, ax = plt.subplots() ax.set_title(‘Плотнось распределения вероятности’) ax.set_xlabel(‘x’) ax.set_ylabel(‘f(x)’) x = np.linspace(148, 200, 100) # X от 148 до 200 y = (1 / (5 * math.sqrt(2*math.pi))) * np.exp((-(x-178)**2) / (2*5**2)) ax.plot(x, y) plt.show() …

Total answers: 1

Add vrect with text to plotly express with button

Add vrect with text to plotly express with button Question: I have the following code for a vertical rectangle in plotly express: fig.add_vrect( x0 = ‘2020-04’, x1 = ‘2020-09′, fillcolor="red", opacity=0.25 ) I would like to make a button where the user can toggle with rectangle on and off, and when it’s on there’s some …

Total answers: 1

plotly range slider without showing line in small

plotly range slider without showing line in small Question: I want to use Plotly to generate a line chart with a range slider. the range slider shows the displayed line again. this code is just an example. in my case, I have a lot of subplots and everything is shown twice. is it possible to …

Total answers: 1

Manually set color legend for Plotly line plot

Manually set color legend for Plotly line plot Question: I would like to fix colors for my legend in a plotly line graph. Basically, I have a dataframe df in which there is a column Sex. I already know that my dataframe will hold only 3 possible values in that column. So I would like …

Total answers: 1

Why does plt.quiver flattens the vectors when I give angles?

Why does plt.quiver flattens the vectors when I give angles? Question: So i tried to use plt.quiver, but i couldn’t align the vectors to the grids. When I try to use angles = "xy" it flattens the vectors. When i use angles = "uv" its not aligned. Here is my code: import matplotlib.pyplot as plt …

Total answers: 1