Open sfd99 opened 1 month ago
Thank you for the feedback! I'm not sure if I entirely understand your suggestion, do you mean that querying table should appear in multiple plots at once? Could you perhaps draw it?
Hi Adam!
What I mean is this - for example, see: https://bartonicek.github.io/plotscaper/articles/plotscaper.html#cb2
1) Enter the R code:
library(plotscaper)
names(airquality) <- c("ozone", "solar radiation", "wind",
"temperature", "month", "day")
create_schema(airquality) |>
add_scatterplot(c("solar radiation", "ozone")) |>
add_barplot(c("day", "ozone"), list(reducer = "max")) |>
add_histogram(c("wind")) |>
add_pcoords(names(airquality)[1:4]) |>
render()
OK - 4 linked plots are rendered!
2)
In the top, left-most plot,
Solar Radiaton VS Ozone scatterplot,
when you click on a point in the plot,
say... (200,50),
that point is highlighted in blue by plotscaper,
AND
the value of that point in that plot: (200,50)
would also be displayed.
The value can show either next to the clicked/hovered point or below, in the bottom right of that plot.
3)
And the MAGIC touch:
At the same time,
any other linked plot
ie:
Day VS Max of Ozone barplot,
would also display its own corresponding values,
say:
(12, 50) and (20,50)
just above the 2 plotscaper-highlighted bars in blue.
In Summary :
In response to the original User click, the great interactivity of plotscaper would not only highlight in blue elements in the linked plots, but ALSO display the associated (x,y) values in ALL plots!
Hope I've explained it a little better and that it even makes sense :-)
PS: I tried a sample drawing (below) but I'm a bad artist... SFd99 San Francisco LINUX, Rstudio
Cheers. Interesting idea, you can already do something similar by hovering over the highlighted object in another plot, e.g.:
Showing the query tables in simultaneously all plots might be a bit tricky, since an object in one plot can relate to multiple objects in the other plots. For example, if you query a bar in a barplot, that bar may contain cases which correspond to 10 points in a scatterplot, and so you would have to show 10 tables in the scatterplot. Idk, at least that's my model right now, you hover over one object and see the statistics associated with the object, I might think about it a bit more.
" Interesting idea, you can already do something similar by hovering over the highlighted object in another plot...".
Ok Adam, that works GREAT!.
Q:
Your example pic shows only 1 point selected in the top-left plot w/ coords solar rad: 260 and ozone: 48.
Why does the popup with values in the top-right plot show:
a) day: 16 (ok!...)
plus
b) 2 values for max of Ozone: 48 and max of Ozone: 46 (why TWICE?),
and in 2 different tones of blue?. How to interpret that popup with 2 values with the same label: max of Ozone for the day: 16 bar?.
I did this in R:
> filter(airquality,day==16)
filter: removed 148 rows (97%), 5 rows remaining
ozone solar radiation wind temperature month day
1 14 334 11.5 64 5 16
2 21 191 14.9 77 6 16
3 48 260 6.9 81 7 16
4 22 71 10.3 77 8 16
5 46 237 6.9 78 9 16
so I guess that ozone was: 48 in day 16 of MONTH: 7. 46 in day 16 of MONTH: 9.
But the top-right plot does not reflect the Month value, only the day value...
RAY San Francisco latest Rstudio , UBUNTU LINUX. plotscaper PKG v.0.2.3
The colors represent values the different selection groups. It's perhaps a bit easier to see in a regular barplot:
With three groups, there are three colored segments and three summaries.
With a barplot of maximums, things are a bit trickier, because the maximum operator does not have an inverse. If the current selection includes the maximum of the data (the bar), you will get only one dark blue bar showing up even though there may be unselected cases with lower maximum value (which will show up in the query). The selection is still interpretable, as long as you're comparing one selection group vs. the rest of the data (not multiple selection groups).
There's bit about that in the algebra vignette and I am currently writing a paper about this and will be resubmitting soon, so I'll link to that in the repo once it's published.
Regarding month, you only get queries of the data which is in the plot automatically. So, for example, in the barplot, you only get the x- and y- variables. In scatterplot, you can add arbitrary point queries using:
create_schema(mtcars) |>
add_scatterplot(c("wt", "mpg"), options = list(queries = c("cyl", "am"))) |>
render()
As for aggregation plots like barplots, histograms, etc..., things are again bit more tricky since there isn't one value corresponding to the object but many. Therefore, you need to specify some aggregation function, the same way as, implicitly, you count or sum values in a barplot bar. E.g. in your example, you could aggregate the month by maximum (latest month in the bar/selection), or create a table of months, etc... I have a way to do this on the JavaScript side, but haven't ported it over to R properly yet.
Ooops, I forgot, the aggregate queries actually do work in R already, I just forgot the syntax, you can do the following:
create_schema(mtcars) |>
add_scatterplot(c("wt", "mpg"), list(queries = c("cyl", "am"))) |>
add_barplot(c("cyl"), list(queries = list(c("mpg", "sum")))) |> # A list of variable-reducer pairs
render()
(I need to document this)
Lots of good stuff in your comments above, Adam. Thanks!. Will study and explore carefully...
RAY San Francisco latest Rstudio , UBUNTU LINUX. plotscaper PKG v.0.2.3
Hi Adam,
plotscaper is fascinating!. Slowly studying, learning and understanding...
1 easy Q:
As soon as I release the "Q" key in my keyboard, any "values box" popup disappears. So ... it's hard to take an image snapshot of the plot showing the pop-up w/ useful values, to share with others later.
Is there an easy way to make a plot with any "values box" popup to be PERSISTENT, ie: to continue displaying a plot WITH the popup included, after I release the "Q" key ?.
Thanks for your guidance, Adam! RAY San Francisco latest Rstudio , UBUNTU LINUX. plotscaper PKG v.0.2.3
Sorry that I haven't been replying, I've been a bit busy with writing. There isn't way to make the query table stay up after releasing the Q
key currently, but it shouldn't be too difficult to add. I'll try to think of some intuitive way of doing it & see about adding it to the next release.
Thanks Adam!
Yes, please do. "Persistent" ON/OFF pop-ups could be very useful.
Q how were you able to "capture" the plot snapshots, (in your answer, above) ?:
See? You were able to show some plotscaper plots WITH the sample pop-ups included...
I don't know how to do that with my LINUX screenshot capture program, because as soon as I release the "Q" keyboard key, the pop-up in the plot will disappear...
How did you take the Image snapshots which INCLUDE the values pop-up? RAY and also:
Hi Adam,
Following the really clear, easy AirQuality and Penguins examples.
A useful suggestion, (if I may):
Greatest win-win feature ever!. :-) SFd99 San Francisco Rstudio in Ubuntu LINUX.