How to make a bar chart on range of values on x-axis and count on the range on y-axis in python?

Shreehari W

I have a list such as [0.2,0.4,1.2,2.4,5.4,6.0,0.3,3.4..] and I want to group the values in the list to a range(interval can change for different inputs) 0-1,1-2,2-3 and would like to plot a graph where the x-axis is the range and y-axis depicts the no_of_values in the given range?

For the above problem, {0-1:3,1-2:1,2-3:1,3-4:1,4-5:0,5-6:2}

Thanks in advance

iudeen

Try using pandas.DataFrame.hist

pd.DataFrame(ls).hist()

where ls = [0.2,0.4,1.2,2.4,5.4,6.0,0.3,3.4]

enter image description here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Indicating a range for the Y axis in a bar chart

How to show unit on bar chart range axis

How to plot with same x and y axis range and interval between values using python?

How to make a bar-chart by using two variables on x-axis and a grouped variable on y-axis?

Plot bar chart with specific range of x axis in MATLAB

How to change the range of the x-axis and y-axis in matlibplot?

How to make X axis timescale with equal interval between elements on chart independent of time range

Afree chart : How to increase X axis values(gap or domain range) while zooming

How to create a grouped bar chart (by month and year) on the x-axis and values on the y-axis using matplotlib.pyplot?

How to make a vertical bar chart with two values per every X axis item

Python PPTX - How to set chart axis number format and range

How to remove decimal values on x-axis of bar chart : Highcharts

How to hide the y axis and x axis line and label in my bar chart for chart.js

How to set tics in x or y axis using range in GNU Octave?

How to make a categorical count bar plot with time on x-axis?

Setting Range for X,Y Axis-JfreeChart

Stacked bar chart swap x-axis and y-axis

Show X Axis and align to y axis range in Gnuplot

Is it possible to change color text or background of label Y-Axis of Range bar chart

How to specify x/y axis label values outside chart

How to add x-axis lable in python bar chart

how to create a bar chart in python with multiple x-axis

MS Chart X Axis label repeated - showing multiple points for a single item [Range Bar]

How to update the date range on X-Axis with python-pptx

Changing Range in Y axis of Boxplot in Python

How to avoid overlapping of X-axis values and Y-axis values in Radar chart?

How to obtain generated x-axis and y-axis range in plotly plot?

Change y axis range of a secondary axis in python Matplotlib

Plotly: How to set the range of the y axis?