-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adding-plotBuilder #345
base: master
Are you sure you want to change the base?
adding-plotBuilder #345
Conversation
The PR above fixes the wrapper issues. You should be able to load the module and get the main analysis function running. |
The code is nicely formated and quite readable, I think it's pretty much compliant with the JASP style. Very nice! There are two issue I will need you to help us with (which is also what Don mentioned in the Mattermost channel). That's:
but this easily messes the internal JASP namespace. Instead, it's highly preferred to use e.g.,
This will, unfortunately, require some rewriting of the code, but pretty much tidyverse convenience functions have baseR alternatives. I don't really use tidyverse at all so it's a bit challenging to me figure out what are all the imported functions (apart from the pipe signs haha), but I would guess that using ChatGPT like tool could make this not too difficult. Does this seem reasonable to you and that it would be manageable for you to implement? |
trying to weed out tidyverse, tidyr and dplyr. Obviously tidyplot will
stay, because it would be more complicated in ggplot. i will try, but i
can't promise to succeed :D but i will let you know in time if i can't do
it.
…On Thu, 30 Jan 2025 at 09:29, František Bartoš ***@***.***> wrote:
The code is nicely formated and quite readable, I think it's pretty much
compliant with the JASP style. Very nice! There are two issue I will need
you to help us with (which is also what Don mentioned in the Mattermost
channel). That's:
1. *not importing the complete package namespaces*, i.e., your
original NAMESPACE file had,
import(jaspBase)
import(jaspGraphs)
import(ggplot2)
import(tidyplots)
import(rlang)
import(dplyr)
import(tidyr)
import(ggprism)
import(patchwork)
import(tidyverse)
import(ggpubr)
import(ggeasy)
import(forcats)
but this easily messes the internal JASP namespace. Instead, it's highly
preferred to use e.g.,
ggplot2::ggplot() + ggplot2::theme_void() notation
2. *trimming down on some of the large package dependencies wherever
possible*. The main issues are
- tidyverse
- tidyplots
- tidyr
- dplyr
(am I missing some @vandenman <https://github.com/vandenman> ?). We
cannot really ship those packages because a) they have an extremely large
dependency base and the potential of breaking JASP during the update is too
big, and b) they are most wrappers meant for analysis scripts but not for
package development - they are not very stable and they might change (which
would brick the analysis). Maybe Don has a more precise explanation on this.
This will, unfortunately, require some rewriting of the code, but pretty
much tidyverse convenience functions have baseR alternatives. I don't
really use tidyverse at all so it's a bit challenging to me figure out what
are all the imported functions (apart from the pipe signs haha), but I
would guess that using ChatGPT like tool could make this not too difficult.
Does this seem reasonable to you and that it would be manageable for you to
implement?
—
Reply to this email directly, view it on GitHub
<#345 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AVW2D7J2ZJKHSNDCEHYKGUD2NHPE3AVCNFSM6AAAAABWDWDJA6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMRTHAZTIOBZGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
tidyr and dplyr are both imported by tidyplots (so removing them while keeping tidyplots won't help that much). I think tidyverse has to go for sure, but @vandenman will have the final say for the rest |
As an aside, I have asked @PabRod to stress this point in the documentation. If we make a list of things that contributors ought to be aware of, this one might break into the top 3.... |
OK, I look forward to your reply.
unfortunately, i am not able to replace tidyplot. the module has become
possible because tidyplot makes the implementation of ggplot quite easy
:(... but i think i can solve the tidyvers.
…On Thu, 30 Jan 2025 at 09:50, František Bartoš ***@***.***> wrote:
tidyr and dplyr are both imported by tidyplots (so removing them while
keeping tidyplots won't help that much). I think tidyverse has to go for
sure, but @vandenman <https://github.com/vandenman> will have the final
say for the rest
—
Reply to this email directly, view it on GitHub
<#345 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AVW2D7IVOEQMAN6NGYIXJU32NHRWFAVCNFSM6AAAAABWDWDJA6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMRTHA3TIMZXGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Also, will this still be as relevant when we have our online module library in llace? I know this will take a while to get done, but still useful to know [correction: we want this in Des riptives, so part of the JASP core functionality] |
Going by the list here I would suggest
A good rule of thumb with dependencies (that we sadly aren't very strict about) is that everything in github.com/tidyverse and github.com/r-lib is fine to use, and the rest we look at on a case-by-case basis. |
also, you need to adjust the |
ggprism
this should definitely go? i don't know how else i can easily solve the
problem of adding p values to the plots.
…On Thu, 30 Jan 2025 at 10:49, Don van den Bergh ***@***.***> wrote:
also, you need to adjust the DESCRIPTION file otherwise the unit tests
will surely fail to install the package.
—
Reply to this email directly, view it on GitHub
<#345 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AVW2D7OGV2OIDZIXRCL2NGT2NHYTBAVCNFSM6AAAAABWDWDJA6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMRUGAYDKMRQHA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
what about |
okay, i try to solve it with ggpubr! thanks.
…On Thu, 30 Jan 2025 at 11:24, Don van den Bergh ***@***.***> wrote:
what about ggpubr::geom_bracket
<https://rpkgs.datanovia.com/ggpubr/reference/geom_bracket.html>? that
looks quite similar to ggprism::add_pvalue
<https://csdaw.github.io/ggprism/reference/add_pvalue.html>.
—
Reply to this email directly, view it on GitHub
<#345 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AVW2D7PBLU3FHK3BQZBDF2L2NH4VRAVCNFSM6AAAAABWDWDJA6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMRUGA4DKOJWG4>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Am I allowed to use import() or importFrom(), or library() inside the
script, or should I use the package::function format?
Mátyás Bukva ***@***.***> ezt írta (időpont: 2025. jan. 30., Cs
11:26):
… okay, i try to solve it with ggpubr! thanks.
On Thu, 30 Jan 2025 at 11:24, Don van den Bergh ***@***.***>
wrote:
> what about ggpubr::geom_bracket
> <https://rpkgs.datanovia.com/ggpubr/reference/geom_bracket.html>? that
> looks quite similar to ggprism::add_pvalue
> <https://csdaw.github.io/ggprism/reference/add_pvalue.html>.
>
> —
> Reply to this email directly, view it on GitHub
> <#345 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/AVW2D7PBLU3FHK3BQZBDF2L2NH4VRAVCNFSM6AAAAABWDWDJA6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMRUGA4DKOJWG4>
> .
> You are receiving this because you authored the thread.Message ID:
> ***@***.***>
>
|
Sorry, import without brackets of course :D
Mátyás Bukva ***@***.***> ezt írta (időpont: 2025. jan. 30., Cs
17:52):
… Am I allowed to use import() or importFrom(), or library() inside the
script, or should I use the package::function format?
Mátyás Bukva ***@***.***> ezt írta (időpont: 2025. jan. 30.,
Cs 11:26):
> okay, i try to solve it with ggpubr! thanks.
>
> On Thu, 30 Jan 2025 at 11:24, Don van den Bergh ***@***.***>
> wrote:
>
>> what about ggpubr::geom_bracket
>> <https://rpkgs.datanovia.com/ggpubr/reference/geom_bracket.html>? that
>> looks quite similar to ggprism::add_pvalue
>> <https://csdaw.github.io/ggprism/reference/add_pvalue.html>.
>>
>> —
>> Reply to this email directly, view it on GitHub
>> <#345 (comment)>,
>> or unsubscribe
>> <https://github.com/notifications/unsubscribe-auth/AVW2D7PBLU3FHK3BQZBDF2L2NH4VRAVCNFSM6AAAAABWDWDJA6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMRUGA4DKOJWG4>
>> .
>> You are receiving this because you authored the thread.Message ID:
>> ***@***.***>
>>
>
|
nothing, I solved what I asked for
…On Thu, 30 Jan 2025 at 17:54, Mátyás Bukva ***@***.***> wrote:
Sorry, import without brackets of course :D
Mátyás Bukva ***@***.***> ezt írta (időpont: 2025. jan. 30.,
Cs 17:52):
> Am I allowed to use import() or importFrom(), or library() inside the
> script, or should I use the package::function format?
>
> Mátyás Bukva ***@***.***> ezt írta (időpont: 2025. jan. 30.,
> Cs 11:26):
>
>> okay, i try to solve it with ggpubr! thanks.
>>
>> On Thu, 30 Jan 2025 at 11:24, Don van den Bergh <
>> ***@***.***> wrote:
>>
>>> what about ggpubr::geom_bracket
>>> <https://rpkgs.datanovia.com/ggpubr/reference/geom_bracket.html>? that
>>> looks quite similar to ggprism::add_pvalue
>>> <https://csdaw.github.io/ggprism/reference/add_pvalue.html>.
>>>
>>> —
>>> Reply to this email directly, view it on GitHub
>>> <#345 (comment)>,
>>> or unsubscribe
>>> <https://github.com/notifications/unsubscribe-auth/AVW2D7PBLU3FHK3BQZBDF2L2NH4VRAVCNFSM6AAAAABWDWDJA6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMRUGA4DKOJWG4>
>>> .
>>> You are receiving this because you authored the thread.Message ID:
>>> ***@***.***>
>>>
>>
|
I think When JASP loads a module, it loads the namespace of all its analyses (in the same way as if you develop an R package). It is very easy to get namespace conflicts among analyses within the same module. Therefore, the |
never |
hi!
today I finished what you asked me to do.
so, what's left:
ggplot2
tidyplots
rlang
dplyr
tidyr
forcats
patchwork
ggpubr
ggpubr was also left as discussed because of the p value.
package::function() "annotation" was used everywhere (except for the base R
functions).
I fixed the qml code in one or two lines, and I also touched the R script
in a few places.
the changes are committed
…On Fri, 31 Jan 2025 at 13:43, Don van den Bergh ***@***.***> wrote:
Am I allowed to use import() or importFrom(), or library() inside the
script, or should I use the package::function format?
never library, import is fine for e.g., jaspBase. importFrom I'd use if
you use have a function from a package that you use often. pkg::function
I'd use in most other cases.
—
Reply to this email directly, view it on GitHub
<#345 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AVW2D7JY3VWRBQE2NGXTDI32NNVVRAVCNFSM6AAAAABWDWDJA6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMMRXGIYDGMRRHA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Sorry, the addition of the #2 tag was completely accidental |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just went over the QML, see the comments below. Overall this looks really good and complete, thanks!
Form { | ||
columns: 1 | ||
|
||
infoBottom: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two things.
- This looks generated. If it is, can you add the R code to generate this as a comment above this for future updates?
- You can do string continuation with
\
(see https://forum.qt.io/topic/113667/multiline-strings/2). Not sure how to handle\n
though.
/// Here begins the main plot control | ||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
TabView { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please indent this with tabs instead of spaces? :)
inst/qml/jaspPlotBuilder.qml
Outdated
DropDown { | ||
name: "sortYLabelsOrder" | ||
label: "Sort Y labels" | ||
values: ["Increasing", "Decreasing"] | ||
startValue: "Increasing" | ||
} | ||
|
||
DropDown { | ||
name: "aggregationFunY" | ||
label: "By" | ||
values: ["mean", "median"] | ||
startValue: "mean" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
qsTr
for the labels and see other comment about values and startvalues.
inst/qml/jaspPlotBuilder.qml
Outdated
DoubleField { | ||
name: "topMargin" | ||
label: "Top" | ||
value: 10 | ||
} | ||
DoubleField { | ||
name: "bottomMargin" | ||
label: "Bottom" | ||
value: 10 | ||
} | ||
DoubleField { | ||
name: "leftMargin" | ||
label: "Left" | ||
value: 10 | ||
} | ||
DoubleField { | ||
name: "rightMargin" | ||
label: "Right" | ||
value: 10 | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
labels need qsTr
.
inst/qml/jaspPlotBuilder.qml
Outdated
{ label: "Default: JASP colors", value: "colors_JASP" }, | ||
{ label: "Discrete: Friendly", value: "colors_discrete_friendly" }, | ||
{ label: "Discrete: Seaside", value: "colors_discrete_seaside" }, | ||
{ label: "Discrete: Apple", value: "colors_discrete_apple" }, | ||
{ label: "Discrete: Friendly Long", value: "colors_discrete_friendly_long" }, | ||
{ label: "Discrete: Okabe Ito", value: "colors_discrete_okabeito" }, | ||
{ label: "Discrete: IBM", value: "colors_discrete_ibm" }, | ||
{ label: "Discrete: Metro", value: "colors_discrete_metro" }, | ||
{ label: "Discrete: Candy", value: "colors_discrete_candy" }, | ||
{ label: "Discrete: Alger", value: "colors_discrete_alger" }, | ||
{ label: "Discrete: Rainbow", value: "colors_discrete_rainbow" }, | ||
{ label: "Continuous: Viridis", value: "colors_continuous_viridis" }, | ||
{ label: "Continuous: Magma", value: "colors_continuous_magma" }, | ||
{ label: "Continuous: Inferno", value: "colors_continuous_inferno" }, | ||
{ label: "Continuous: Plasma", value: "colors_continuous_plasma" }, | ||
{ label: "Continuous: Cividis", value: "colors_continuous_cividis" }, | ||
{ label: "Continuous: Rocket", value: "colors_continuous_rocket" }, | ||
{ label: "Continuous: Mako", value: "colors_continuous_mako" }, | ||
{ label: "Continuous: Turbo", value: "colors_continuous_turbo" }, | ||
{ label: "Continuous: Blue Pink Yellow", value: "colors_continuous_bluepinkyellow" }, | ||
{ label: "Diverging: Blue to Red", value: "colors_diverging_blue2red" }, | ||
{ label: "Diverging: Blue to Brown", value: "colors_diverging_blue2brown" }, | ||
{ label: "Diverging: BuRd", value: "colors_diverging_BuRd" }, | ||
{ label: "Diverging: BuYlRd", value: "colors_diverging_BuYlRd" }, | ||
{ label: "Diverging: Spectral", value: "colors_diverging_spectral" }, | ||
{ label: "Diverging: Icefire", value: "colors_diverging_icefire" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
labels need qsTr
R/jaspPlotBuilder.R
Outdated
updatedPlots <- plotResults$updatedPlots | ||
|
||
if (!is(jaspResults[["plotGridContainer"]], "JaspContainer")) { | ||
plotGridContainer <- createJaspContainer(title = "Plot Grid") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plotGridContainer <- createJaspContainer(title = gettext("Plot Grid"))
we should mark this titles text by gettext/gettextf to make it translatable.
inst/qml/jaspPlotBuilder.qml
Outdated
name: "PlotBuilderTab" | ||
|
||
rowComponent: Group { | ||
|
||
childControlsArea.anchors.leftMargin: jaspTheme.contentMargin | ||
|
||
Group{ | ||
columns:2 | ||
TextField { | ||
name: "plotId" | ||
label: qsTr("Plot ID") | ||
fieldWidth: 200 | ||
placeholderText: qsTr("Enter Plot ID") | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name: "PlotBuilderTab" | |
rowComponent: Group { | |
childControlsArea.anchors.leftMargin: jaspTheme.contentMargin | |
Group{ | |
columns:2 | |
TextField { | |
name: "plotId" | |
label: qsTr("Plot ID") | |
fieldWidth: 200 | |
placeholderText: qsTr("Enter Plot ID") | |
} | |
name: "PlotBuilderTab" | |
newItemName: qsTr("Plot 1") | |
rowComponent: Group { | |
childControlsArea.anchors.leftMargin: jaspTheme.contentMargin | |
Group{ | |
columns:2 | |
Adding the newItemName
automatically names the tabs "Plot 1", "Plot 2", ...
(and users can rename them by double clicking them)
These can be also used as the plotId
- a bit of an annoying issue now is that you need to fill in the idea first, otherwise the whole analysis is terminated with an error. Using the tab names circumvents the issue (in case you names without spaces and special symbols, it should be easy to replace them with underscores using gsub etc?)
This needs to be propagated into the R-code. While now the code takes the plotId
from options[["PlotBuilderTab"]][[1]][["plotId"]], now it should refer to the name in options[["PlotBuilderTab"]][[1]][["value"]]
(I did not do that as it's a too big change for a suggested change here)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's a great idea! thanks a lot! just a couple of lines to rewrite and it works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks :) I will do a deeper dive and more suggestions once all the previous parts are addressed (it's a bit of a mess with al the qml suggestions right now) Could you maybe just prompt me to do so on mattermost?
Co-authored-by: Don van den Bergh <[email protected]>
Co-authored-by: Don van den Bergh <[email protected]>
Co-authored-by: Don van den Bergh <[email protected]>
Co-authored-by: Don van den Bergh <[email protected]>
Co-authored-by: Don van den Bergh <[email protected]>
Co-authored-by: Shun Wang <[email protected]>
Co-authored-by: Shun Wang <[email protected]>
and some commented script
No description provided.