Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 plotting histogram
#1
Hi All,

I count the number of grades appeared in the dataset and trying to plot it as histogram.

it works ,but couldn't get the grade name as x-axis.

data on the count dataframe looks like 
Vermin V
V1     1
V10    1
V11    1
V2     1
V3     2
V4     2
V5     3
V6     6
V7     4
V8     2
V9     1
dtype: int64

i tried the below code 

>>> plt.hist(vermin_v)
(array([ 5.,  0.,  3.,  0.,  1.,  0.,  1.,  0.,  0.,  1.]), array([ 1. ,  1.5,  2. , ...,  5. ,  5.5,  6. ]), <a list of 10 Patch objects>)

i am getting a histogram ,but the numeric values appear on x-axis instead of vermin grades.


how can i get the vermin grades v1,v10etc on the x axis?

Thanks
vvv
Quote
#2
Are you sure that you want a histogram? As a histogram is to show distribution of numerical data, there are usually no labels beside numeric values on x axis ...

Perhaps you want just ordinary barplot, showing counts V1, V2 etc? If so, then easiest way is to use directly your pandas series with value counts:
count_serie.plt('bar')
plots barplot and uses index values (your V1, V2 ...) as labels.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Alternative ways of plotting confusion matrix amjass12 0 81 Aug-14-2019, 07:21 PM
Last Post: amjass12
  How to fit a 2D histogram like in ROOT? Zandar 2 111 Aug-06-2019, 03:01 PM
Last Post: Zandar
  Comparing three functions and plotting specific regions japrap 2 132 Aug-06-2019, 12:41 AM
Last Post: japrap
  plotting of graphs mudezda1 2 374 Feb-11-2019, 12:44 PM
Last Post: mudezda1
  Frequency Filter for wav file plotting in python manukanu 0 916 Dec-11-2018, 09:58 AM
Last Post: manukanu
  histogram error alyssaantarctica 1 548 Jul-09-2018, 10:46 PM
Last Post: Larz60+
  Plot Probability Density of an Histogram Python_TLS 1 551 Jun-28-2018, 06:19 AM
Last Post: scidam
  Plotting climate data with NetCdf files for a specific region with coordinates fyec 3 825 Jun-27-2018, 12:34 PM
Last Post: buran
  histogram with matplotlib vaugirard 10 1,285 Jun-01-2018, 04:13 AM
Last Post: vaugirard
  Help creating a histogram using an array rubadub 0 548 Apr-17-2018, 08:57 PM
Last Post: rubadub

Forum Jump:


Users browsing this thread: 1 Guest(s)