Skip to main content

All Questions

33 votes
3 answers
49k views

Customizing the order of legends in plotly

I am trying to customize the order of legends while plotting stacked bar plots in plotly,python. data = [ go.Bar( y=df['sid'], # assign x as the dataframe column 'x' ...
Natasha's user avatar
  • 1,431
1 vote
2 answers
2k views

Why do matplotlib legend elements have the same colour?

I am doing a bar plot and adding the legends. The code is the following: import numpy as np import matplotlib.pyplot as plt rectArr = list() fig, ax_arr = plt.subplots(nrows=2, ncols=1, figsize=(8,8),...
roschach's user avatar
  • 9,044
2 votes
1 answer
427 views

How to create two legend objects for a single plot instance?

I use the following example code to generate a bar plot. import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, 5, 5) y = np.exp(x) w = x[1] - x[0] colors = ['blue' if idx % 2 == 0 ...
user avatar