-
Notifications
You must be signed in to change notification settings - Fork 1
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 Plotly Configurations #544
Conversation
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.
Mir ist nichts unbeabsichtigtes aufgefallen. 👍
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.
Finde ich voll cool, dass du dich an dieses Thema rangetraut hast und auch schon in so vielen Files Änderungen gemacht hast!! Danke dafür auf jeden Fall :)
Ich hab ein paar kleinere Anmerkungen oder Fragen dran geschrieben, unter anderem würde ich gerne die import *
Stellen anders behandeln, damit man dann genauer sieht, was wo in welcher File von wo verwendet wird. Kannst ja mal gerne sagen, was du dazu meinst ^^
@@ -1,7 +1,7 @@ | |||
import matplotlib.pyplot as plot | |||
from sklearn.metrics import PrecisionRecallDisplay, RocCurveDisplay | |||
|
|||
from protzilla.constants.colors import PROTZILLA_DISCRETE_COLOR_SEQUENCE | |||
from protzilla.constants.colors import * |
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.
Ich frage mich, ob es hier vielleicht sinnvoll/"Best Parctice" wäre, die Namen der Konstanten zu importieren? Dann weiß man, was es gibt, ohne dass man die andere File anschauen muss (für Code-Verständlichkeit und so, musste an SWT denken)
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.
Genau das gleiche habe ich mich auch gefragt ... Meine Gedanken waren hierzu:
- Der Name
protzilla.constants.colors
sollte intuitiv genug sein, dass sich in der File halt konstante Variablen mit Farben befinden. - Nicht unbedingt in
data_analysis
, aber in den anderen Sections werden eigentlich alle drei Variablen (Liste, primary und secondary Farben) verwendet - daher fand ich es an der Stelle sinnvoller, einfach*
zu schreiben, statt etwas umständlich alle drei einzeln zu importieren.
Ich schreibe aber mal unten als einzelnen Kommentar, was mir gerade generell als Kompromiss einfällt! :)
protzilla/data_analysis/plots.py
Outdated
@@ -8,7 +8,7 @@ | |||
from scipy import stats | |||
from sklearn.metrics.pairwise import cosine_similarity, euclidean_distances | |||
|
|||
from protzilla.constants.colors import PROTZILLA_DISCRETE_COLOR_SEQUENCE | |||
from protzilla.constants.colors import * |
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.
hier würde ich das gleiche wie oben anmerken
protzilla/data_analysis/plots.py
Outdated
@@ -326,8 +326,8 @@ def prot_quant_plot( | |||
fig = go.Figure() | |||
|
|||
color_mapping = { | |||
"A": PROTZILLA_DISCRETE_COLOR_SEQUENCE[0], | |||
"C": PROTZILLA_DISCRETE_COLOR_SEQUENCE[1], | |||
"A": PROTZILLA_COLOR_SEQUENCE[0], |
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.
warum hast du manchmal [0] und manchmal primary color? Wäre es da sinnvoll das irgendwie auch einheitlich zu machen?
@@ -7,7 +7,7 @@ | |||
from protzilla.constants.protzilla_logging import logger | |||
from protzilla.utilities.utilities import fig_to_base64 | |||
|
|||
from ..constants.colors import PROTZILLA_DISCRETE_COLOR_SEQUENCE | |||
from ..constants.colors import * |
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.
hier auch die gleiche Bemerkung wie oben, bzw könnte man hier halt genau nur die eine Konstante importieren, da nur die verwendet wird und in anderen Files wo mehr verwendet wird, dann alle importieren
@@ -325,10 +270,9 @@ def create_anomaly_score_bar_plot( | |||
:param anomaly_df: pandas Dataframe that contains the anomaly score for each\ | |||
sample, including outliers and on-outliers samples | |||
:param colour_outlier: hex code for colour depicting the outliers. | |||
Default: PROTZILLA_DISCRETE_COLOR_OUTLIER_SEQUENCE outlier colour | |||
Default: PROTZILLA_SECONDARY_COLOR |
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.
Verstehe ich es richtig, dass die secondary color generell die "outlier color" ist? Wenn ja, fände ich es schön, dafür einen Kommentar in der colors.py zu haben, dann weiß man das direkt?
@@ -520,7 +520,7 @@ class PlotClustergramForm(MethodForm): | |||
label="Choose dataframe to be used for coloring", | |||
required=False, | |||
) | |||
flip_axis = CustomChoiceField( | |||
flip_axes = CustomChoiceField( |
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.
(Habe hier gerade noch nicht ganz den Code Überblick, daher ist die Frage vielleicht unnötig) Ist die Änderung auch an der Stelle, wo die Variable verwendet wird, angepasst oder wo wäre das dann?
@@ -423,7 +423,7 @@ def export_workflow(request: HttpRequest, run_name: str): | |||
display_message( | |||
{ | |||
"level": 20, | |||
"msg": f"Workflow '{requested_workflow_name}' was exported successfully.<br>You can view it here: {os.path.join(settings.BASE_DIR, 'user_data', 'workflows')}", | |||
"msg": f"Workflow '{requested_workflow_name}' was exported successfully.<br>You can view the file at {WORKFLOWS_PATH}.", |
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.
Viel schöner :D
Kompromiss(Danke an @sarahvgls für das Anstoßen der Diskussion in den Reviews!) Ich bin gespannt auf Eure Meinungen hierzu! :) |
Umbenennung zu PLOT_COLOR_SEQUENCE finde ich sinnvoll nach deinen genannten Gründen. |
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.
Also ich finde es super übersichtlich und richtig toll so, vielen Dank!! :D
|
||
PLOT_SECONDARY_COLOR = PLOT_COLOR_SEQUENCE[1] | ||
"""Second color in list.""" |
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.
Finde ich richtig schön so!!!
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.
Sieht insgesamt alles viel ordentlicher, einheitlicher und verständlicher aus und funktioniert bei mir auch :)
Description
fixes #
Added constants to export workflow message
Added new plotly template for custom configuration for all plots
Included template in data preprocessing plots
Renamed color constants, changed the order to have the primary and secondary colors at index 0 and 1 - and included those changes in other files accordingly
Changes
/constants/colors.py got new color names
/constants/paths.py has small change in composition of paths
/data_analysis/model_evaluation_plots.py uses new color naming
/data_analysis/plots.py uses new color naming
/data_integration/di_plots.py uses new color naming
/data_preprocessing/plots.py no longer sets manual settings for plotly, got some refactoring to be more consistent with plotly properties and methods and uses new color naming
/utilities/plot_template.py has a new plotly template which is set as default
/ui/runs/forms/data_analysis.py fixed typo in input parameter
/ui/runs/forms/data_integration.py uses new color naming
/ui/runs/views.py has new message text
Testing
PR checklist
Development
Mergeability
black
Code review