6

I want to show plots in Dataset. Something like this

Table[<|"a" -> 
    ListPlot[RandomReal[1, 10], Frame -> True, ImageSize -> 200],
   "b" -> 
    ListLinePlot[RandomReal[1, 10], Frame -> True, 
     ImageSize -> 200]|>, {i, 1, 5}] // Dataset

will give

enter image description here

You can see

  1. the Frame is not showing
  2. ImageSize is not working

How to correctly show plots in Dataset?

matheorem
  • 17,132
  • 8
  • 45
  • 115

1 Answers1

6

I came up with a solution using ItemDisplayFunction

Define

data=Table[<|
"a"->ListPlot[RandomReal[1,10],Frame->True,ImageSize->200],
"b"->ListLinePlot[RandomReal[1,10],Frame->True,ImageSize->200]|>,{i,1,5}];

then

dset=Dataset[data, ItemDisplayFunction -> (StandardForm[#] &)]

enter image description here

However, if we select two rows,

dset[[{1,2}]]

still gives

enter image description here

For this, I can only solve it awkwardly by Normal and Dataset again like

Dataset[Normal@dset[[{1,2}]],ItemDisplayFunction -> (StandardForm[#] &)]

gives

enter image description here

matheorem
  • 17,132
  • 8
  • 45
  • 115
  • You can use SetOptions to include that option everytime you use Dataset. For example: SetOptions[Dataset, ItemDisplayFunction -> (StandardForm[#] &)] or SetOptions[Dataset, ItemDisplayFunction -> (Pane[#] &)] – chuy Nov 16 '21 at 17:13
  • @chuy Hi. Thank you for reply. It would be a much better solution. However, I tried your solution, it didn't work – matheorem Nov 17 '21 at 00:12