When I follow the examples in the pandas documentation for visualizing a bar chart:
https://pandas.pydata.org/pandas-docs/version/0.23/generated/pandas.DataFrame.plot.bar.html
See the first example titled Basic plot. with 3 bars.
The pandas documentation shows:
But when I type the same in my local jupyter notebook, I get no color:
Why does my notebook not have color? What can I do to display the colors?
You can pass custom colors to df.plot:
df = pd.DataFrame({"lab":["A","B","C"], "val":[10,20,30]})
df.plot.bar(x="lab", y="val", rot=0, color = ["y","c","m"])
Result:
Here is a LINK to the some more about the one-letter color abbreviations
Related
I'm struggling with how to turn the result of my code into a bar chart.
Code:
Result:
tried unsuccessfully add data to a dataframe
May be you can use matplotlib.pyplot and from that import plt. To create a bar chart use plt.bar function.
I want to use my own colour palette for the hue. I am following the documentation but for some reason, I can't get it right.
Here is my code:
%matplotlib inline
colors = ["#ff4c8b", "#00d8d5",'#f7f7f7']
sns.set_style(rc={'axes.facecolor':'black','figure.facecolor':'black','axes.grid' : False})
s=sns.lineplot(data=data, x="timestamp", y="close.quote",palette=sns.set_palette(sns.color_palette(colors)), hue='contract_ticker_symbol')
Instead of using the three colours I defined, it uses the default hue palette.Can someone tell me what I am doing wrong
I am using a seaborn regplot with the following code :
sns.relplot(x="NumCustomers", y="TotalSales", hue = 'StoreLabel', data=stores_month, height = 5, aspect = 2, s = 100);
To generate the following plot :
But the colors are hard to differentiate, after scouring google managed to get this code :
sns.color_palette("tab10")
but nothing happens. How can I change the color pallet to something with better contrast? preferably the tab10 palette.
try
sns.set_palette("Blues")
or
sns.set_palette("Dark")
sns.set_style()
1.white
2.dark
3.whitegrid
4.darkgrid
5.ticks
The set palette api must occur before the relPlot
other apis to try catDist, distPlot, catPlot
I think catPlot would work better
I am trying to set Interval Unit (for interval between labels) of chart using openpyxl. This option is set to 'Automatic' by default.
Image shows how we can set the option manually in Excel. Image Link
I found this option in XlsxWriter:
chart.set_x_axis({'interval_unit': 5})
but could not find the option in openpyxl.
Please help.
For bar and column charts in openpyxl the axis labeling individual data is of type openpyxl.chart.axis.TextAxis. TextAxis features a property named tickLblSkip which defines what you are looking for. You can set a labeling interval of 5 as follows:
from openpyxl.chart import BarChart
chart = BarChart
chart.x_axis.tickLblSkip = 5
The question self explains itself. Here is the link that I'm following.
Thanks
what is with chart.set_chartarea() or chart.set_plotarea()?
See the following links:
http://xlsxwriter.readthedocs.org/en/latest/chart.html#set_plotarea
http://xlsxwriter.readthedocs.org/en/latest/chart.html#set_chartarea
Regards
For Changing the background colors of the plot area and chart area, the 'set_plotarea()andset_chartarea()` on the chart object will need to be called with the appropriate color.
For filling the background colors of the bar charts, key value like 'fill':{'color':'yellow'} while adding the series on the chart object should do.
For example:
chart.add_series({'values': '=Sheet1!$C$1:$C$5','fill':{'color': 'yellow'}})