How can I reduce the width of the histogram?


Itsuyama

I have plotted a histogram of diagnostics, which I modeled as a Poisson distribution in python. I need to reduce the width of the rectangles in the output graph.

I wrote the following line in python. I need the width reduction parameter for this line of code.

fig = df['overall_diagnosis'].value_counts(normalize=True).plot(kind='bar',rot=0, color=['b', 'r'], alpha=0.5)
Jonathan Gagne

You are looking for matplotlib.pyplot.figure. You can use it like this:

from matplotlib.pyplot import figure
figure(num=None, figsize=(10, 10), dpi=80, facecolor='w', edgecolor='k')

Here is an example of how to do this:

names = ['group_a', 'group_b', 'group_c']
values = [1, 10, 100]

plt.figure(1, figsize=(9, 3))

plt.subplot(131)
plt.bar(names, values)
plt.subplot(132)
plt.scatter(names, values)
plt.subplot(133)
plt.plot(names, values)
plt.suptitle('Categorical Plotting')
plt.show()

Related


How can I reduce the width of the histogram?

Itsuyama I have plotted a histogram of diagnostics, which I modeled as a Poisson distribution in python. I need to reduce the width of the rectangles in the output graph. I wrote the following line in python. I need the width reduction parameter for this line

How can I reduce the width of the area?

Dimitri Danilov Currently, I have this: I want to delimit these 3 elements to something like this: <th class="fc-day-header fc-widget-header fc-sat" data-date="2016-10-01">JOUR 1<br>samedi 1 octobre</th> I tried reducing the width of the fc-day-header class,

How can I reduce the width of the margin value?

Martin Atger Here is my code: div{ border: 1px solid red; height: 20px; } span{ display: table; border: 1px solid green; height: 10px; width: 100%; margin-left:20px; } <div> <span></span> </div> As yo

How can I reduce the width of the slanted column header?

Khansab Here is the output table: I'm looking for a solution that can reduce the width of the table header, I've tried several solutions, but none of them work. Below is my code: <Style> /*additional CSS*/ td, th { border: 1px solid black; fon

How can I reduce the width of the slanted column header?

Khansab Here is the output table: I'm looking for a solution that can reduce the width of the table header, I've tried several solutions, but none of them work. Below is my code: <Style> /*additional CSS*/ td, th { border: 1px solid black; fon

How can I reduce the width of the slanted column header?

Khansab Here is the output table: I'm looking for a solution that can reduce the width of the table header, I've tried several solutions, but none of them work. Below is my code: <Style> /*additional CSS*/ td, th { border: 1px solid black; fon

How can I fix the histogram

aa I am trying to draw a very simple histogram using python. Here is my code: from numpy import * from matplotlib.pyplot import* from random import* nums = [] N = 10 for i in range(N): a = randint(0,10) nums.append(a) bars= [0,1,2,3,4,5,6,7,8,9] hist(

How can I fix the histogram

aa I am trying to draw a very simple histogram using python. Here is my code: from numpy import * from matplotlib.pyplot import* from random import* nums = [] N = 10 for i in range(N): a = randint(0,10) nums.append(a) bars= [0,1,2,3,4,5,6,7,8,9] hist(

How can I shift the histogram to the right?

alagnak32 I have a 1D array of histograms with bin boundaries: bins = np.arange(1, 6,2) data = np.array([1,2,3,4,4,4,3,2,3,3,3]) plt.hist(data, bins=bins, histtype='step') But I want to move the histogram horizontally by 1 unit to the right on the x-axis, how

How can I rename the xlabel for this histogram?

Jaffet Leon I'm making a histogram for a database about household income and education level and everything is fine, but when I try to rename the x labels, I simply can't: cces$faminc_new1 = recode(cces$faminc_new, "1" = "Less than $10

How can I rename the xlabel for this histogram?

Jaffet Leon I'm making a histogram for a database about household income and education level and everything is fine, but when I try to rename the x labels, I simply can't: cces$faminc_new1 = recode(cces$faminc_new, "1" = "Less than $10

How can I make this histogram in ggplot/R?

Crimea Please find My data qbelow . I have two covariates: q$Studieand q$best.respcorresponding to each of the five different studies reporting the best response after a certain treatment. q$best.respThere are three levels table(q$best.resp) 0 1 2 62 42

How can I represent the classes on the histogram with colors?

Subhankar Nayak I have a column in a dataset which I represent with a pyplot.hist graph. Use grey as a trash can. Another column by which I want to divide the graph is called "Class". There are two categories (0 and 1) in the Category column. I would like to r

How can I shift the histogram to the right?

alagnak32 I have a 1D array of histograms with bin boundaries: bins = np.arange(1, 6,2) data = np.array([1,2,3,4,4,4,3,2,3,3,3]) plt.hist(data, bins=bins, histtype='step') But I want to move the histogram horizontally by 1 unit to the right on the x-axis, how