Home > Mobile >  poster quality publication chart
poster quality publication chart

Time:07-06

OK, I have the following data, that I needed to plot bar chart with.

import pandas as pd
import matplotlib.pyplot as plt

data1 = {'Mode': ['foot', 'bike', 'bus', 'car', 'metro'],
         'Segments': [4443, 306, 1070, 5947, 322]}

data2 = {'Mode': ['foot', 'bike', 'bus', 'car', 'metro'],
         'Segments': [2224, 132, 817, 2078, 179]}

So I want plot bar chart of these dfs to a section of my poster (left column of section) under methodology section,such that it is readable.

Expected chart format: enter image description here

I created the above chart in Google sheet, but it is not readable when inserted to poster template (available in Google slides).

If relevant, my poster template has the following font sizes:

Title = 85 points
Author = 56 points
Headings = 78 points
sub-headings = 36 points
body text = 30 points

CodePudding user response:

You can specify the styles you want with plt.rcParams. First, define the actual size these graphs should be. For example, if your poster has 1m of width, two columns, and you're placing two barplots side by side, then their widths would be about 9x8 inches. Then, you can set the labels and ticks and so on to the size you want, for example, 30 points for text. Do this in the beginning of your code, then do your plots. For example:

plt.rcParams['font.size'] = 30
plt.rcParams['figure.figsize'] = (9, 8)
plt.rcParams['xtick.major.width'] = 4
plt.rcParams['ytick.major.width'] = 4
plt.rcParams['xtick.major.size'] = 10
plt.rcParams['ytick.major.size'] = 10
plt.rcParams['figure.dpi'] = 600
spines_linewidth = 3

fig, ax = plt.subplots()
ax.bar(data1['Mode'], data1['Segments'])

xpositions = [0, 1, 2, 3, 4]
shift = 150
for i, segment in enumerate(data1['Segments']):
    ax.text(xpositions[i], segment   shift, segment, ha='center')
    
for spine in ax.spines:
    ax.spines[spine].set_linewidth(spines_linewidth)
    
ax.set_ylim(top=6500)

Resulted in this:

enter image description here

Now it's a matter of you styling the colors/etc to better match the rest of your poster, then exporting your figures and moving them to Google Slides.

  • Related