Skip to content


You can specify the size of the chart's margins, in pixels. Margins are calculated inward from the specified chart size (chs); increasing the margin size does not increase the total chart size, but rather shrinks the chart area, if necessary. The chart margins include the axis labels.


  • <left_margin>, <right_margin>, <top_margin>, <bottom_margin> Minimum margin size around the chart area, in pixels. Increase this value to include some padding to prevent axis labels from bumping against the borders of the chart. Unlike the old deprecated Google Image Charts API, negative margins are also allowed.


In the example below we set a left_margin to 10px, a right_margin to 100px and a top_margin to 20px. Since we did not define bottom_margin, its value will be set to 0px.



Negative margins are a great way to hide axis. Below is an horizontal bar that simulate a progress bar (left_margin: -10px, bottom_margin: -10px):

progress bar