ClearML - dynamically updating Plotly plots? - python

I have a question related to ClearML plot logging. We are currently using:
self.task_logger.report_table("TableSpaceName", "Some Info", iteration=0, table_plot=df)
To report tables. They appear under "PLOTS" section. Similarly, we are reporting plotly graphs:
self.task_logger.report_plotly(
title="PlotTitle", iteration=0, series='SeriesName', figure=fig
)
Both work fine. The issue is, each new report_plotly call, instead of replacing the image in the section, creates a new one, and leaves the previous one present too. This cloggs the PLOTS section (tables and figures). The question is, how does one report a plot, so that it's reported in-place (Such as e.g., scalars, where sample plot gets updated in time)?

Turns out that ClearML sorts by "title" param. Hence, having e.g., title="Part 1: someStuff" will be placed before title="Part 2: someOtherStuff".

Disclaimer: I'm part of the ClearML team
Are you providing a fixed title, series and iteration values? If so, this should not happen and is probably a bug

Related

HeatMapWithTime(Folium), show values as persistent after timebar has reached a specific point

i am currently working with HeatMapWithTime, it is working fine. But i want more. I am working with geopoints, one per timestamp. After pass over a specific timestamp with the slider, i want that the heatmap stays updated without only showing the current point. So that all points passed also showed up on the map. Is This possible? Is there mabye any tool in python that work better then Folium?
Actually i did not find something that comes close to this, would appreciate any help.

Use a list with Matplotlib bar_label() in order to label bar

Currently, I'm using the bar_label() new feature from Matplotlib v3.4.0.
My code is as follow and works perfectly :
ax.bar_label(ax.containers[0])
However, I would like to use different values as label. These values are available in a list.
I tried :
ax.bar_label(my_list)
But it doesn't work.
Is there any way to use bar_label() with a custom list ?
As mentionned in the comment by BigBen, labels parameter is the good thing to use.
Be careful to use also container (both are working together !)

Python-PPTX Date Axis

Is there a way using the python-pptx package to change the base units and major values for a date axis? ie being able to set the X axis for a time series chart to be in years, and to only show every 5th year as a label?
I found this link in the docs, but I can't figure out how to set these attributes using python.
Thanks in advance!
That feature is supported by PowerPoint but unfortunately not yet by python-pptx.
The <c:dateAx> child elements responsible for that behavior are <c:majorUnit> and <c:minorUnit>. If you can edit the c:dateAx subtree to add those (or perhaps just change their attribute values if they already exist) then you might be able to produce the behavior you're after. Note that child element order is significant in PresentationML so you can't just append those elements at the end, you'll need to fit them in at the right place (sequence is specified here: https://github.com/scanny/python-pptx/blob/master/pptx/oxml/chart/axis.py#L128).

Control tick-labels from multi-level FactorRange

I've got a three-level bokeh.models.FactorRange which I use to draw tick labels on a vbar-plot. The problem is that there are dozens of factors in total and the lowest-level labels get very cramped.
I can use plot.xaxis.formatter = bokeh.models.PrintfTickFormatter(format='') to suppress drawing of the lowest-level labels, but this seems like an ugly hack. Also, I need to have the second-level tick labels to be rotated, yet plot.xaxis.major_label_orientation = ... only ever affects the lowest-level ticks (just like plot.xaxis.formatter does).
How to control each level of bokeh.models.FactorRange individually?
As of Bokeh 0.12.13, there is no way to control the individual orientations or formatting of different levels.
The basic initial work to revamp categorical support (for multi-level axes, etc) was a large update. Rather than add more even complexity and risk up front for features we were not sure anyone would want or need, we started with basic capability, expecting to hear from users in time what additional features were justified. This seems like it has come up a few times, so it would be reasonable to consider adding, but it would represent new work, so a GitHub feature request issue is the appropriate next step.
For completeness, I will mention that Bokeh is extensible, so it's always technically possible to create a Custom Extension. Axes are some of the most complicated code in Bokeh, and a full custom Axis would be non-trivial to write. However it's possible that would be sufficient to make subclass of CategoricalAxis and just override this one method:
https://github.com/bokeh/bokeh/blob/master/bokehjs/src/coffee/models/axes/categorical_axis.ts#L83-L110
That's where the currently hard-coded 'parallel' orientation are, and also where formatting could be overridden.
In latest Bokeh (2.2.0), the feature #bigreddot was talking about seems to have been implemented: you can call
p.xaxis.group_label_orientation = [angle in radians]
to set orientation of the outer labels, while as in the question
p.xaxis.major_label_orientation = [angle in radians]
sets the orientation of the inner labels.

Create bokeh timeseries graph using database info

Note from maintainers: this question is about the obsolete bokeh.charts API removed several years ago. For an example of timeseries charts in modern Bokeh, see here:
https://docs.bokeh.org/en/latest/docs/gallery/range_tool.html
I'm trying to create a timeseries graph with bokeh. This is my first time using bokeh, and my first time dealing with pandas as well. Our customers receive reviews on their products. I'm trying to create a graph which shows how their average review rating has changed over time.
Our database contains the dates of each review. We also have the average review value for that date. I need to plot a line with the x axis being dates and the y axis being the review value range (1 through 10).
When I accepted this project I thought it would be easy. How wrong I was. I found a timeseries example that looks good. Unfortunately, the example completely glosses over what is the most difficult part about creating a solution. Specifically, it does not show how to create an appropriate data structure from your source data. The example is retrieving pre-built datastructures from the yahoo api. I've tried examining these structures, but they don't exactly look straightforward to me.
I found a page explaining pandas structs. It is a little difficult for me to understand. Particularly confusing to me is how to represent points in the graph without necessarily labeling those points. For example the y axis should display whole numbers, but data points need not intersect with the whole number value. The page I found is linked below:
http://pandas.pydata.org/pandas-docs/stable/dsintro.html
Does anyone know of a working example for the timeseries chart type which exemplifies how to build the necessary data structure?
UPDATE:
Thanks to the answer below I toyed around with just passing lists into lines. It didn't occur to me that I could do this, but it works very well. For example:
date = [1/11/2011, 1/12/2011. 1/13/2011, 4/5/2014]
rating = [4, 4, 5, 2]
line(
date, # x coordinates
rating, # y coordinates
color='#A6CEE3', # set a color for the line
x_axis_type = "datetime", # NOTE: only needed on first
tools="pan,wheel_zoom,box_zoom,reset,previewsave" # NOTE: only needed on first
)
You don't have to use Pandas, you simply need to supply a sequence of x-values and a sequence of y-values. These can be plain Python lists of numbers, or NumPy arrays, or Pandas Series. Here is another time series example that uses just NumPy arrays:
http://docs.bokeh.org/en/latest/docs/gallery/color_scatter.html
EDIT: link updated

Categories

Resources