data-visualization

d3.js, how can i create an axis with custom labels and customs ticks?

ぐ巨炮叔叔 提交于 2019-12-06 07:40:09
I have an array similar to this: [{year: 1999, val: 5}, {year: 2002, val: 8}] and I would like to add an axis where I have one tick for each year value (something I can do with tickValues and tickFormat) but where the tick label is not only the year but has a custom format, so the result could be something like "1999: 5" for the first array element. To rephrase it: Where I'm now const xAxis = d3.axisTop(xScale) .tickValues(data.map(d => d.year); This is not ok because only the year is visualized on the label of the tick and I would like to use a custom format. Is this possible with d3? You

Why is matplotlib basemap not plotting the colours of some areas in my map?

梦想与她 提交于 2019-12-06 06:30:07
问题 The code below is supposed to colour all the states of Vietnam: import pandas as pd import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap fig, ax = plt.subplots(figsize=(10,20)) # create the map map = Basemap(resolution='l', # c, l, i, h, f or None projection='merc', lat_0=15.95, lon_0=105.85, llcrnrlon=102., llcrnrlat= 8.31, urcrnrlon=109.69, urcrnrlat=23.61) # load the shapefile, use the name 'states' map.readshapefile(r'path\to\gadm36_VNM_1', name='states', drawbounds

Adjusting small multiples sparklines

谁都会走 提交于 2019-12-06 06:27:31
问题 I have an heatmap that show some data and a sparkline for each line of the heatmap. If the user click on a row label, then the data are ordered in decreasing order, so each rect is placed in the right position. Viceversa, if the user click on a column label. Each react is placed in the right way but I'm not able to place the sparkline. Here the code. When the user click on a row label, also the path inside the svg containing the sparkline should be updated. And then, when the user click on a

D3js: How to interpolate datasets with irregular time intervals before stacking them?

寵の児 提交于 2019-12-06 04:22:51
UPDATE: The jsfiddle example illustrates the problem: http://jsfiddle.net/T8SuH/ I am new to both D3js and JavaScript but comfortable with Java. I have a large CSV dataset from a bike-sharing system organized as follows: event_id, station_id, timestamp, number_of_bikes, number_of_empty_docks To reduce file size, my data file contains only new events for individual stations. Therefore timestamps of different stations are neither in regular time intervals nor they coincide. For example consecutive entries might look like this: 31044955, 08, 2012-05-01 00:00:00, 9, 6 31044965, 23, 2012-05-01 00

R: underscore letters in forest plot of meta-analysis using the metafor package

♀尐吖头ヾ 提交于 2019-12-06 04:16:59
This question was migrated from Cross Validated because it can be answered on Stack Overflow. Migrated 6 years ago . Is there a way to present symbols (e.g. greek letters, symbols or underscore/upperscore letters) as labels in a forest plot of an rma() object generated by the forest() function of the metafor package? Here is a nonsense example but it hopefully illustrates the underlying idea: library(metafor) data(dat.bcg) labs <- paste(dat.bcg$author, dat.bcg$year) ## Replace the first label with a greek letter, a superscript and a subscript labs[1] <- expression(beta[123]^123) res <- rma(ai

How to set the image size in Vis.js network graph

血红的双手。 提交于 2019-12-06 04:07:27
I am building a network graph using vis.js The problem is, how do I make all the images the same size ? (see live example here --> comparison of wordpress & drupal ) here's the graph code: var nodes = []; nodes.push({ id: 7, shape: 'image', image: '/static/windows8_icons/PNG/Industry/circuit/circuit-26.png', label: 'sharepoint', widthMin: 20, widthMax: 20 }); edges.push({ from: 1, to: 7, length: 100 }); var data = { nodes: nodes, edges: edges }; var options = { smoothCurves: false, stabilize: false, nodes: { shape: 'image', radius: 24, fontSize: 18, widthMin: 20, widthMax: 20 }, edges: { width

Visualize images in intermediate layers in torch (lua)

百般思念 提交于 2019-12-06 03:57:46
问题 In the conv-nets model, I know how to visualize the filters, we can do itorch.image(model:get(1).weight) But how could I efficiently visualize the output images after the convolution? especially those images in the second or third layer in a deep neural network? Thanks. 回答1: Similarly to weight, you can use: itorch.image(model:get(1).output) 回答2: To visualize the weights: -- visualizing weights n = nn.SpatialConvolution(1,64,16,16) itorch.image(n.weight) To visualize the feature maps: --

Displaying a D3 tree with multiple parents

给你一囗甜甜゛ 提交于 2019-12-06 03:11:16
问题 I currently have this graph implemented and I'm hoping to keep the structure and collapsibility while depicting a child node having multiple parents. Is there a way to do this? I looked into force graphs but I'm also wanting to preserve a set hierarchy (meaning a parent at level 1 can have a child and level 3 shown). After a lot of research and tinkering with my current code, I am unable to figure my issues out. Is there anyone who has any experience with displaying a D3 tree node with

How to deal with a lot of plots in R

試著忘記壹切 提交于 2019-12-06 03:02:46
I have a for loop which produces 60 plots. I would like to save all this plots in only one file. If I set par(mfrow=c(10,6)) it says : Error in plot.new() : figure margins too large What can I do? My code is as follows: pdf(file="figure.pdf") par(mfrow=c(10,6)) for(i in 1:60){ x=rnorm(100) y=rnorm(100) plot(x,y) } dev.off() MrGumble Your default plot, as stated in the loop, does not use the space very effectively. If you look at just a single plot, you can see it has large margins, both between axis and edge and plot area and axis text. Effectively, there is a lot of space-hogging. Secondly,

Increasing row height in R heatmap() function

↘锁芯ラ 提交于 2019-12-06 01:57:29
问题 This question was migrated from Cross Validated because it can be answered on Stack Overflow. Migrated 7 years ago . I have a matrix with hundreds of rows and tens of columns and wish to plot a heatmap. If I use the native R function: heatmap(matrix(sample(1:10000),nrow=1000,ncol=10)) I get a figure with illegible row titles. I assume the image is produced to match the specifications of the current plotting device. I'd like control over the height of the rows, even if this can't be displayed