hafen / trelliscopejs

TrelliscopeJS R Package
https://hafen.github.io/trelliscopejs
Other
263 stars 37 forks source link

When axis limits are "same", only show axes on the margins #8

Open hafen opened 7 years ago

hafen commented 7 years ago

For the sake of screen real-estate, it would be nice to be able to not repeat axes across panels in a grid when it is not necessary (when all axes are the same). To do this, we would need whatever plotting mechanism to be able to save out the rendered axes separately and then save the panels with axes removed. Then an update in TrelliscopeJS would need to be made to accommodate this.

This should be possible with ggplot2 and rbokeh at a minimum - we should be able to figure out how to extract and store the axes separately and then remove axes from the panels with these packages.

hafen commented 7 years ago

@schloerke, how difficult would it be to add an internal function for ggplot2 plots, extract_axes(), that pulls out the red and blue parts of the example plot shown below and saves them out, along with a function, extract_plot_content(), that extracts the green part? extract_axes() would only need to be pulled out once per Trelliscope display, and then we would use extract_plot_content() for each individual panel.

trs_axis

schloerke commented 7 years ago

I have them written in GGally. I'll make them functions in here as well to avoid depends

schloerke commented 7 years ago

I guess I need plot size (or viewport size) to make the final saves. Otherwise, I can't tell how tall or wide to save the components.

hafen commented 7 years ago

These will be called from facet_trelliscope() which requires width and height. These are the dimensions at which the plots are saved (the viewer takes care of scaling based on layout). So we can use these dimensions.

schloerke commented 7 years ago

helper methods added in #20 . They are not integrated, but an example is there.

schloerke commented 7 years ago

I should have this finished up by today