Remove spaces around bars in PDF format

I have a graph:

> data = c(1, 5, 3, 4)
> barplot(data, space = 0, col = 'gray', border = 0)

In OS X, using the default driver (Quartz), it looks like this:

bar plot screenshot

Note that there is no between the columns . However, when exporting a drawing to PDF,

  • through quartz.save('file.pdf', type = 'pdf')or
  • through pdf('file.pdf', type = 'pdf')followed bybarplot(…)

The result is as follows:

bar plot PDF export

Between the rods are clearly visible lines. Unfortunately, in my case, this is more than just an aesthetic inconvenience: Im draws a lot of thin pixel bars, and the space between the bars is almost the same as the bars themselves, which dramatically changes the perception of the plot.

Is there any way to get rid of the lines in the output? Preferably when using a device pdfrather than PDF quartzoutput?

+4
1

:

barplot(data, space = 0, col = 'gray', border = 'gray')

EDIT: .

, , . :

data = c(1, 5, 3, 4)
pdf('file.pdf') 
barplot(data, space = 0, col = 'gray', border = 'gray')
dev.off()

enter image description here

+6

Source: https://habr.com/ru/post/1525605/


All Articles