emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Change both width and height of R plot in SRC block


From: Gerardo Moro
Subject: Change both width and height of R plot in SRC block
Date: Thu, 30 Jun 2022 11:10:46 +0300

Hi, 

I have been trying for over a year to change the output plot size when using Orgmode SRC blocks with R. I have tried both using orgmode settings and R settings. 

I have a table from which I take some values.

#+name: cost
#+begin_src R :results output file graphics :file imag/cost.jpg :var tab=cost
library(ggplot2)

ggplot(tab, aes(x = date, y = cost)) +
geom_line(color="darkgreen") + geom_point() +
scale_x_date(date_breaks = "1 day",
date_labels = "%b %d") +
theme(axis.text.x = element_text(angle = 90)) +
scale_y_continuous(breaks=seq(100,200,1)) +
ylim(100, 200)
#+end_src

The resulting plot (only showing the x axis) is squared, so the resulting X axis is not legible at all:

#+RESULTS: cost
image.png

I have spent months to try to figure out how to have a non-square plot showing in Orgmode, to no avail.

This presses me to stop using Emacs for graphing altogether.

I have head that this has more to do with R than with Emacs, but I have tried all the R code advice out there.

I also have tried of course the #+attr_org: :width 600px :height:300px, but it only considers the width, so I end up with another square.

If any of you has a solution,  much appreciated!

Best, 
G. Moro

reply via email to

[Prev in Thread] Current Thread [Next in Thread]