data-visualization

How to highlight a bar by datetime value with Altair

橙三吉。 提交于 2020-06-16 17:10:30
问题 Similar to : https://altair-viz.github.io/gallery/bar_chart_with_highlighted_bar.html, is it possible to highlight a bar based on a specific date time value? I can't quite seem to make it work. import pandas as pd import altair as alt import datetime df = pd.DataFrame( { "year": [2019, 2019, 2019], "month": [1, 3, 7], "day": [1, 1, 1], "value": [5, 7, 9], } ) df["Mth"] = pd.to_datetime(dict(year=df["year"], month=df["month"], day=df["day"])) df.drop( ["year", "month", "day"], axis=1, inplace

How to highlight a bar by datetime value with Altair

佐手、 提交于 2020-06-16 17:09:57
问题 Similar to : https://altair-viz.github.io/gallery/bar_chart_with_highlighted_bar.html, is it possible to highlight a bar based on a specific date time value? I can't quite seem to make it work. import pandas as pd import altair as alt import datetime df = pd.DataFrame( { "year": [2019, 2019, 2019], "month": [1, 3, 7], "day": [1, 1, 1], "value": [5, 7, 9], } ) df["Mth"] = pd.to_datetime(dict(year=df["year"], month=df["month"], day=df["day"])) df.drop( ["year", "month", "day"], axis=1, inplace

How to change the distance between nodes in a force layout?

↘锁芯ラ 提交于 2020-06-13 06:20:08
问题 I am new to D3 and try to learn force layout. I want to change the link distance between nodes and maintain the origin shape. I find that after I change the distance of the links, the layout was changed. Figure one is the original layout, then I changed the link distance with code distance([150]) (at line 80) to make the nodes further, but the layout changes out of my expectation. I expected it the layout will grow up with keeping the shape as same as original, but the layout changes a lot. I

Custom color palette intervals in seaborn heatmap

帅比萌擦擦* 提交于 2020-06-13 06:09:50
问题 I am trying to plot a heatmap using seaborn library. The plotting function looks like this: def plot_confusion_matrix(data, labels, **kwargs): """Visualize confusion matrix as a heat map.""" col_map = kwargs.get('color_palette', sns.light_palette('navy', n_colors=5, as_cmap=False)) sns.heatmap( vmin=0.0, vmax=1.0, data=data, cmap=col_map, xticklabels=labels, yticklabels=labels, linewidths=0.75, ) The histogram of the data , however, looks like this: Now the issue I am struggling with is that

How to add value labels on the flows item of a Alluvial/Sankey plot (on R ggalluvial)?

丶灬走出姿态 提交于 2020-06-11 10:39:45
问题 I'm looking to label the "flow" portion of Alluvial / Sankey chart on R. The stratums (columns) can easily be labelled, but not the flows connecting them. All my attempts on reading the documentations and experimenting were to no avail. In the sample below, "freq" is expected to be labelled on the flow connection part. library(ggplot2) library(ggalluvial) data(vaccinations) levels(vaccinations$response) <- rev(levels(vaccinations$response)) ggplot(vaccinations, aes(x = survey, stratum =

How to add value labels on the flows item of a Alluvial/Sankey plot (on R ggalluvial)?

老子叫甜甜 提交于 2020-06-11 10:39:25
问题 I'm looking to label the "flow" portion of Alluvial / Sankey chart on R. The stratums (columns) can easily be labelled, but not the flows connecting them. All my attempts on reading the documentations and experimenting were to no avail. In the sample below, "freq" is expected to be labelled on the flow connection part. library(ggplot2) library(ggalluvial) data(vaccinations) levels(vaccinations$response) <- rev(levels(vaccinations$response)) ggplot(vaccinations, aes(x = survey, stratum =

Error in Google BigQuery <EOF>

不问归期 提交于 2020-05-26 10:38:33
问题 I am new to Google BigQuery. I need help with the query error: "Encountered " "WITH" "with "" at line 1, column 1. Was expecting: EOF" with t1 as ( select date(USEC_TO_TIMESTAMP(event_dim.timestamp_micros)) date, event_dim.name from [myfoody-1313:it_rawfish_myfoody_ANDROID.app_events_20160727] where event_dim.name='pv_detail' and event_dim.params.key='item_id' and event_dim.params.value.string_value='31' ) select date(d) as day, count(event_dim.name) from generate_series(current_date -

Python bokeh slider not refreshing plot

杀马特。学长 韩版系。学妹 提交于 2020-05-18 01:47:05
问题 I am creating a bokeh plot with a slider to refresh plot accordingly. There are 2 issues with the code posted. 1. The plot is not refreshed as per the slider. Please help in providing a fix for this issue. 2. Plot is not displayed with curdoc() when bokeh serve --show fn.ipynb is used I'm trying to visualise this CSV file. import pandas as pd import numpy as np from bokeh.models import ColumnDataSource, CategoricalColorMapper, HoverTool, Slider from bokeh.plotting import figure, curdoc from

Rhandsontable in Shiny

拟墨画扇 提交于 2020-05-17 04:17:53
问题 EDIT: I included observeEvent() in server.R as described in this video : https://www.youtube.com/watch?v=BzE1JmC0F6Q. It works partially. When I update A and B, the graph gets updated, but the columns C,D and E are giving wrong values and the number of rows keep growing. Any help is appreciated. I have 2 columns A and B. The user has the option to drag and drop values into A and B , and hence I am using rhandsontable (Source: https://jrowen.github.io/rhandsontable/) I have the code below for

Rhandsontable in Shiny

丶灬走出姿态 提交于 2020-05-17 04:16:08
问题 EDIT: I included observeEvent() in server.R as described in this video : https://www.youtube.com/watch?v=BzE1JmC0F6Q. It works partially. When I update A and B, the graph gets updated, but the columns C,D and E are giving wrong values and the number of rows keep growing. Any help is appreciated. I have 2 columns A and B. The user has the option to drag and drop values into A and B , and hence I am using rhandsontable (Source: https://jrowen.github.io/rhandsontable/) I have the code below for