0

I am trying to make a candle chart in R.

In my sample 5m candle chart, rendered into PNG properly and neatly. Like the one below:

good chart

But when I give it real data with a week long 5m candle data, the chart renders all blurred like below:

bad chart

The part of code I have used:

png( labels$pngfile, height=labels$height,width=labels$width)
par(mar=c(12,6,3,6))
plot( df$high, main=labels$title, xaxt="n", xlab="", ylab="price", ylim=c( mn, mx ), type="n",las=1 ) 
par( new=T )
plot( df$low, main="", axes=F, xlab="", ylab="", ylim=c( mn, mx ), type="n" ) 
segments( x0=xs, y0=df$open, x1=xs, y1=df$close, col=color_list, lwd=4 ) 
segments( x0=xs, y0=df$low, x1=xs, y1=df$high, col=color_list, lwd=1 ) 
dev.off()

Please suggest how to fix the blur. Thanks.

thevikas
  • 1,618
  • 1
  • 14
  • 31
  • How do you save the plot? You may want to try `png()` which allows you to set the resolution, read https://stackoverflow.com/q/7144118/6574038 – jay.sf Jul 30 '20 at 09:06
  • Saving it with png(...). – thevikas Jul 30 '20 at 09:21
  • Have you played with the `width=, height=, res=` options of `png`? – jay.sf Jul 30 '20 at 09:24
  • Little bit with the width prop. Enlarging it by width too much or even shrinking it. No diff. – thevikas Jul 30 '20 at 09:28
  • Perhaps you want to make your issue reproducible, read: [how-to-make-a-great-r-reproducible-example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610#5963610) – jay.sf Jul 30 '20 at 09:35

0 Answers0