This is a problem linked to RStudio (see here). It occurs when the Plots pane area is smaller than the plot area.
Solutions:
- Enlarging the Plots pane (thanks to @Roman Luštrik for the suggestion). However it doesn't always work. Sometimes the plot area is still greater than the Plots pane area, even after increasing it.
- Using "raw R" as suggested by @Roman Luštrik (thanks again). It solves the problem completely since R adapts the plot size to the plotting window.
- Plotting to a file also solves the problem when using RStudio.