automation – How to automatically add data series to line chart when new row of data added to underlying sheet?

I have a line chart where the X-axis is Day of Week and Y-axis is a count. The underlying sheet has Sunday dates in column A, where each row is one week apart, and columns B-H have count values for Sunday through Saturday, one week per row.

The sheet auto-updates as new data comes in, but not the chart.

In Chart Editor > Setup > Data range I specified A1:H1000, and when I click the Add Series button at the bottom the chart editor readily offers up the new rows (i.e. I don’t have to specify the cell ranges, they are already detected) but I do have to explicitly click each one to add them to the chart.

Is there a way to bypass this final manual step, so the chart draws a new data series line whenever a new row of data is added to the underlying sheet?

javascript – ChartJS: Chart not displaying full range of data

My ChartJS chart is not displaying all the data. This is the closest question on SO to my problem. Implementing the answer to this question did not help (I tried both ({display: false}) and ({display: true})).

I am a novice at chartjs having only started working with it some ~5 days ago. Any help or advice would be appreciated.

Basically, I am writing a chart that takes data collected by a Raspberry Pi and plots it.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Harp comfort</title>
    <script src="https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/chart.js@2.8.0"></script>
  </head>
  <body>
    <h1>Temperature data</h1>
    <canvas id="myChart"></canvas>

    <script>
      // Data from: Raspberry Pi Hat     

      window.addEventListener('load', setup);      
      var ops = {
        scales: {
            xAxes: ({
                display: false
                  }),
                yAxes: ({
                        ticks: {
                            beginAtZero: true
                               }
                       })
               }
              };
      async function setup() {
        const ctx = document.getElementById('myChart').getContext('2d');
        const dataTemp = await getData();
        const myChart = new Chart(ctx, {
          type: 'line',
          data: {            
            datasets: (
              {
                label: 'Temperature',
                data: dataTemp.temp,        
                fill: false,
                borderColor: 'rgba(255, 99, 132, 1)',
                backgroundColor: 'rgba(255, 99, 132, 0.85)',
                borderWidth: 2
              }              
            )
          },
         options: ops
        });
      }

      async function getData() {        
        const response = await fetch('./sample.csv');
        const data = await response.text();        
        const temp = ();        
        const rows = data.split('n').slice(1);
        rows.forEach(row => {
          const col = row.split(',');          
          temp.push(parseFloat(col(0)))
          //console.log(col(0)) //for debugging purpose
        });
        return { temp };
      }
      //getData(); for debugging purpose
    </script>
  </body>
</html>

The CSV data (dummy data for now) is available via this PasteBin page

pandas – Bar chart: conditional colors python matplotlib

I have the following dataframe:

      key1 key2 key3 ...
time
Jan   0.5  0.4  0.2  ...
Feb   0.3  0.4  0.4  ...
Mar   0.2  0.4  0.1  ...
Apr   0.5  0.3  0.8  ...
...   ...  ...  ...

I created a bar chart plot as follows:

import matplotlib.pyplot as plt
ax = df10.plot(kind='bar', figsize=(15, 10), fontsize=12, stacked='true')
plt.show()

This gives me a stacked bar chart with many bars and many colors, which does not provide a good overview at first glance.
I thus want to highlight only those bars that make an impact (>0.5) and hide the unimportant ones (by coloring them grey).

The goal is therefore some conditional coloring: bars, whose values are below 0.5 should be colored in grey, the rest should receive predefined colors.

I tried so many ways and cant find a solution that works. I am pretty new to python/matplotlib.
Can anyone help me please? Thank you very much in advance, any help is highly appreciated!

How to display thousnds of datasets in a chart

I have logged all the songs I have listened to on Spotify in a database. I now want to display the songs I’ve listened to in relation to how often I have listened to them on a website, the problem being that I have listened to over 1500 so far this year and fitting that on a screen while (trying to) keep song names and the number of times I’ve listened to a specific song readable seems to be impossible.

Is there an elegant solution for this? Is there a specific kind of chart that I need (have been using bar charts so far)?

Python – network color chart based on the length of the routes (Pyhton, Osmnx, Networkx)

I currently have a diagram that shows the shortest paths between all nodes in my network and my destination: Enter the image description here

Now I want to create a color map in which I color the origin nodes and the edges based on the distance of the shortest path. Can someone help me?

I have the following:

import networkx as nx
import matplotlib.pyplot as plt
import osmnx as ox
import pandas as pd
import geopandas as gpd
from shapely.wkt import loads as load_wkt

ox.config(log_console=True, use_cache=True)

place = {'city': 'Lisbon', 'country': 'Portugal'}
G = ox.graph_from_place(place, network_type='drive')
G = ox.project_graph(G)
hospitals = ox.pois_from_place(place, amenities=('hospital'))

hosp_1 = hospitals.iloc(21)('geometry')  # Hospital Santa Maria (Polygon)


def poly_centroide(polygon):

# Gives me the coordinates of the center point of the Polygon

    p1 = load_wkt(polygon)
    centroide = p1.centroid.wkt

    return centroide

polygon_1 = str(hosp_1)

coord_1_str = poly_centroide(polygon_1)


coord_1 = (38.74817825481225, -9.160815118526642)  # Coordinates Hospital Santa Maria


target_1 = ox.get_nearest_node(G, coord_1)


routes = ()
for node in G.nodes:
    try:
        route = nx.shortest_path(G, node, target_1)
        routes.append(route)
    except nx.exception.NetworkXNoPath:
        continue

fig, ax = ox.plot_graph_routes(G, routes, edge_linewidth=0.2, node_size=5, route_linewidth=1)
plt.show()

Now I want to know how to create the cmap where the colors of the nodes and edges are based on the distance of the shortest path.

I wonder if that would be possible nx.draw() but i have no idea how …

Thanks in advance.

Bar chart that counts rows Google Sheets / Pandemic-like chart

I have a Google form linked to a Google sheet (a new line is created every time someone fills out the form). I want to create a chart that counts the number of rows per day. In the example below, I want the first bar to have a height of 3, the second to have a height of 6, and then a constant until May 3, 2020, where it goes to 16, etc. Does anyone have a solution for this?

Thank you so much!

Enter the image description here

Money Supply – Understanding the Bitcoin Inflation vs. Time Chart

I keep seeing this table on many websites. This discussion page offers a vector version, so I assume that it was created by the author of the post.

Bitcoin inflation vs. time

Now that I understand what the graph is supposed to show, I have difficulty understanding how it is created; H. Which function produces the two Ys plotted on the X (210k block steps).

Could someone clarify that for me?

Thank you so much!