I am trying to plot the graph through pandas but legend keeps on overlapping with the graph. I tried putting legend on the right side but it still showing with graph
Related
I am aiming to combine two types of charts - a horizontal bar chart using a categorical axis and some form of line, scatter, violin, or similar chart that displays a trace paired with each category on the same axes but "dithers" up and down around some bounds.
Below is sort of what I'm trying to create. However, the shape of the violin chart is generated automatically behind the scenes from scattered points. In my use case, I already have what the distributions are and I'm trying to plot them over top of related data.
I can't find a utility in Plotly that allows me to specify a categorical axis, but then offset points, lines, etc from that category-derived position on the axis.
I have a problem with bar labels, the values overlays with the part of the chart.
This is my code that gives the values, and I am using barplot chart
nam_atl.bar_label(nam_atl.containers[0])
Output:
Is there a way to move it a bit to the side?
I have a xarray dataset clip_ds and have visualised the data array using plot. Now, I want to add a country boundary using Basemap's drawcountries(). Apparently, there is something wrong with the extent I am using in basemap (I guess), but both the country border and the data plot won't show up together. I have tried interchanging the position of clip_ds.pr[0].plot() before and after I create basemap, and it gives me two different results as shown below:
Xarray PLOT BEFORE BASEMAP (Note that the colorbar from xarray plot is still there)
Xarray PLOT AFTER BASEMAP (Notice difference from 3, height of the plot shrinks here and the tick labels disappears, probably overlapped by basemap.)
Xarray plot only
Loading seperate shapefile using map.readshapefile also gives same kind of problem. I know there might be a way around this using cartopy, but I like the Basemap functionalities and would like to know if there is any solution to this.
map=Basemap(projection='merc',
resolution='l',
llcrnrlon=clip_ds.lon[0],
llcrnrlat=clip_ds.lat[0],
urcrnrlon=clip_ds.lon[-1],
urcrnrlat=clip_ds.lat[-1])
map.drawcountries()
clip_ds.pr[0].plot()
plt.show()
Is there a simple way to plot horizontal bars that have different starting positions? The closest example I found in the reference galery is implemented as segments : http://holoviews.org/reference/elements/bokeh/Segments.html
I have a geopandas / matplotlib choropleth plot of a specific type of crime in Cheltenham (criminal damage and arson). I generated the plot (and associated legend) with the following code in a Jupyter notebook:
lsoaBounds.plot(column='Criminal damage and arson', cmap='Reds')
plt.legend(lsoaBounds['Criminal damage and arson'])
I have three questions:
How do I get the legend to show boxes, or swatches, rather than lines, to represent the values across the map?;
How do I sort the legend from highest value to lowest? and;
How do I split the legend across multiple columns?
Screenshot of output included below: