Conversation
dmfalke
left a comment
There was a problem hiding this comment.
This looks great! I do wonder if we should consider hiding plotly internals a bit more. It would be nice to have a generic interface for annotations that we can use with all plots. Is this a reasonable thought? Do we have other examples plots with annotations?
|
Ahh good point. While actually implementing the visx annotations might be out of scope, you're right that we should at least try to define a nice neutral interface that they could both use. I'll work on this! |
Cool! Let me know if you want to bounce ideas around. Something I'm wondering is, what is a reasonable approach to declaring where an annotation will appear. for example, are the annotations for the crispr scatterplots based on min and max points? more generally, is this specific to the dataset type? do we need a crispr-specific scatterplot component to declare these annotations? Anyway, just some random thoughts about this. |
|
Thanks @dmfalke ! I just added a new type. Plotly and visx approach annotations pretty differently, so I attempted to keep the type minimal and let it expand in the future if we need.
There are two ways to define where an annotation goes (in plotly): using a fraction of the axis distance (plotly's 'paper' reference') or an actual point on the plot. The stories I put up have an example of each. But i think your question about a crispr-specific plot is a good one. We don't necessarily need one because we could have another attribute in john's table that declares the annotation position as long as that position is with reference to the axes, not xmin and max. I believe that is the case for these plots - folks just want to see those annotations in the bottom left and top right, but I need to verify. So we don't have to (at least not from what i see right now!) but of course we could! |
|
To answer your earlier question, we do have a plot that uses annotations right now: the volcano visx plot. It has volcano-specific annotations already baked in, and the only thing it needs to know from the context is the text for those annotations. Our thinking was that all volcano plot should always have those annotations, so no need to worry about passing in more than just the annotation text (called the |
|
@asizemore overall, I think this looks great. I'm not sure if you saw this build error: https://github.com/VEuPathDB/web-monorepo/actions/runs/13252170333/job/36992249053?pr=1321. |
|
Once that build error is fixed, I think this can be merged. |
|
oh i didn't! Glad you pointed it out! Sounds good! I'll fix and merge! |
* added plot annotations functionality * improve scatter annotation story * added histogram annotation story * introduce VEuPathDBAnnotation type * fix annotation types in histogram
* checkpoint * Add type annotations to remove inferred `any` type. * Allow an analysis descriptor to be provided to `useAnalysis` * Only update state if the next param value is different than the previous param value * Extract useAnalysisState to allow external state tracking of analysis object * Use useAnalysisState, add counts, etc * Add stubbed question page with custom name * Allow hiding starred variable feature * fix typo * Use global memoization * Encapsulate creation of eda api clients * Adhere to lastest "api" for GenesByEdaSubset * dont wrap sentence * fix label in user comment upload form * Fix volcano plot thumbnail out of sync (#1299) * fix for thumnails not rendering * replace mutating state with better check of filters * Allow html formatting in search page header * Enable override for GenesByEdaSubset and set question page heading dynamically. * use more specific query name * Use alphabetic ordering when displaying a flattened list of eda entities (#1323) * only order variable tree entities alphabetically (#1324) * Add annotations to plotly plots (#1321) * added plot annotations functionality * improve scatter annotation story * added histogram annotation story * introduce VEuPathDBAnnotation type * fix annotation types in histogram * update query name * use dynamic import for plotly, to keep it out of the main bundle * replace "EdaSubsetting" with "EdaSubset" * Revert to injecting script and link tags in document head * rename component * Add custom formatter for stepDetails * Handle empty filters in param value formatter --------- Co-authored-by: aurreco-uga <aurreco@uga.edu> Co-authored-by: Cristina Aurrecoechea <aurreco@palm.penn.apidb.org> Co-authored-by: Ann Sizemore Blevins <asizemore@users.noreply.github.com>
* checkpoint * Add type annotations to remove inferred `any` type. * Allow an analysis descriptor to be provided to `useAnalysis` * Only update state if the next param value is different than the previous param value * Extract useAnalysisState to allow external state tracking of analysis object * Use useAnalysisState, add counts, etc * Add stubbed question page with custom name * Allow hiding starred variable feature * fix typo * Use global memoization * Encapsulate creation of eda api clients * Adhere to lastest "api" for GenesByEdaSubset * Stub in eda scatterplot for phenotype dataset * Allow html formatting in search page header * Enable override for GenesByEdaSubset and set question page heading dynamically. * use more specific query name * update query name * use dynamic import for plotly, to keep it out of the main bundle * replace "EdaSubsetting" with "EdaSubset" * dont wrap sentence * fix label in user comment upload form * Fix volcano plot thumbnail out of sync (#1299) * fix for thumnails not rendering * replace mutating state with better check of filters * Allow html formatting in search page header * Enable override for GenesByEdaSubset and set question page heading dynamically. * use more specific query name * Use alphabetic ordering when displaying a flattened list of eda entities (#1323) * only order variable tree entities alphabetically (#1324) * Add annotations to plotly plots (#1321) * added plot annotations functionality * improve scatter annotation story * added histogram annotation story * introduce VEuPathDBAnnotation type * fix annotation types in histogram * update query name * use dynamic import for plotly, to keep it out of the main bundle * replace "EdaSubsetting" with "EdaSubset" * Revert to injecting script and link tags in document head * Export type * Expand type to include ReactHTML elements * Allow className to be overridden * Add EdaDatasetGraph component * Use EdaDatasetGraph component with EdaPhenotypeGraphsDataTable * simplify layout and add warning message for genes not in experiment * Add parentheses * Wire up highlightIds * Highlight graph_ids * Allow arbitrary variable values to be highlighted * Specify gene variable values to highlight --------- Co-authored-by: aurreco-uga <aurreco@uga.edu> Co-authored-by: Cristina Aurrecoechea <aurreco@palm.penn.apidb.org> Co-authored-by: Ann Sizemore Blevins <asizemore@users.noreply.github.com>
Resolves #1315
Uses plotly's
layout.annotationsprop to add annotations to plots (see examples). Examples included forScatterplotandHistogram, but these annotations could be added to any plotly plot.This PR does not add annotations for visx plots. I considered that as out of scope for the time being.