I am able to do a simple 2D plot inside a Jupyter Notebook (with IHaskell) using the Haskell Chart Package. The code is here,
import Graphics.Rendering.Chart.Easy
cData = [1,2,3,4,3,2,1]
toRenderable $ do
layout_title .= "Recovered Signal"
layout_x_axis . laxis_title .= "Time (msecs)"
layout_y_axis . laxis_title .= "Original Input Level"
plot (line "Amplitude" [zip [0,1..] cData])
The plot is automatically displayed in a Jupyter cell when the code cell returns a 'Renderable'
I would like to make the plot smaller.
I've tried,
- Looking through all the examples on the Wiki but the only size option I saw was with file output.
- I went through the Chart function index looking for 'size', 'width' and found nothing relevant
- I even asked ChatGPT (sorry if that's a bad word) and it failed.
- Google was no help. You can change font size but not the plot size.
- I did find 'plotsToRenderable' which mentions a 'minsize' but it didn't make sense to me.
I'm a mid-level Haskeller but never learned lenses which may be part of my problem. Maybe it's time to learn ..
Any help appreciated!
Tom
Lenses won't help you much... the problem is that IHaskell.Display.Charts hard-codes width and height. It's a bit silly...
What you could do is write your own wrapper type for custom-sized charts, and copy the instances with the specified sizes.