data-visualization

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

荒凉一梦 提交于 2019-12-04 14:19:43
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=True) # shapefile downloaded from http://www.gadm.org/ # collect the state names from the shapefile

Adjusting small multiples sparklines

拈花ヽ惹草 提交于 2019-12-04 14:10:56
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 column label, the svg containing the sparkline should be placed in the correct line. To place the svg

Dot Plot in D3.js

拜拜、爱过 提交于 2019-12-04 13:46:11
I'm interested in creating a Dot plot (the one with the consecutive dots for every data value) but what I've managed so far is to create just a single dot for every value. To be more clear, let's say for the array1 I want for the first value to create 5 circles, for the second 4 circles and so on... array1 = [5,4,2,0,3] Any ideas? Part of my code: var circle = chart.selectAll("g") .data(d) .enter() .append("g") .attr("transform", function(d) { return "translate(" + xScale(d.values) + ",0)"; }); circle.append("circle") .attr("cx", xScale.rangeBand()/2) .attr("cy", function(d) { return yScale(d

Node-based data visualization library in c or objective c

♀尐吖头ヾ 提交于 2019-12-04 13:35:26
问题 I'm looking for a library in c or objective c that does node-data visualizations similar to http://arborjs.org/ helpful answers include, what are graphs like that called? names of libraries that do something like that. suggestions for implementation. I'm targeting iOS and/or MacOS, hence c or objective-c/cocoa. On iOS the javascript version runs super slow. Thanks! Edit: GraphViz looks great. I'm a little concerned it may have dependencies that are GPL, and thus can't be used on iOS...

Pygal Maps World Not Working

情到浓时终转凉″ 提交于 2019-12-04 13:23:36
I am trying to create a simple program so as to display the map of central America with their population using Pygal_maps_world.Here's the code for the same import pygal_maps_world as pa wm=pa.World() wm.title="Map of Central America" wm.add('North America',{'cd': 84949494949,'mx': 494794164,'us': 99794616}) wm.render_to_file('map.svg') I have tried a few combinations regarding the importing of the World maps to work properly but to no avail and i am not able to create the visualization. Help me solve this query of mine Thanks In the recent versions of pygal, you start with the first four

Fill under line curve

落爺英雄遲暮 提交于 2019-12-04 12:35:42
问题 This question was migrated from Cross Validated because it can be answered on Stack Overflow. Migrated 4 years ago . For the sample dataset below, I would like to just plot the y as a smooth line with fill under the line using R. I am able to get smooth line but not the color filled curve. Could someone please help me here? date, y 2015-03-11, 71.12 2015-03-10, 34.0 2015-03-09, 11.1 2015-03-08, 9.62 2015-03-07, 25.97 2015-03-06, 49.7 2015-03-05, 38.05 2015-03-04, 38.05 2015-03-03, 29.75 2015

How to capture value of dropdown widget in bokeh python?

邮差的信 提交于 2019-12-04 12:07:40
问题 The official documentation of bokeh 0.12.1 in the link give the below code for creating a dropdown. http://docs.bokeh.org/en/latest/docs/user_guide/interaction/widgets.html#userguide-interaction-widgets But it doesn't clearly mention how to capture the value of the dropdown widget when someone click and selects a value from the dropdown. from bokeh.io import output_file, show from bokeh.layouts import widgetbox from bokeh.models.widgets import Dropdown output_file("dropdown.html") menu = [(

Node labels on circular phylogenetic tree

我与影子孤独终老i 提交于 2019-12-04 09:59:47
I am trying to create circular phylogenetic tree. I have this part of code: fit<- hclust(dist(Data[,-4]), method = "complete", members = NULL) nclus= 3 color=c('red','blue','green') color_list=rep(color,nclus/length(color)) clus=cutree(fit,nclus) plot(as.phylo(fit),type='fan',tip.color=color_list[clus],label.offset=0.2,no.margin=TRUE, cex=0.70, show.node.label = TRUE) And this is result: Also I am trying to show label for each node and to color branches. Any suggestion how to do that? Thanks! When you say "color branches" I assume you mean color the edges. This seems to work, but I have to

Python: Barplot with colorbar

亡梦爱人 提交于 2019-12-04 09:57:41
I'm trying to make a bar plot with a color bar, each bar's hight is one variable (y) and each bar should have a color depending on another variable (c). What I've got to is this (simple example): data_x = [0,1,2,3] data_hight = [60,60,80,100] data_color = [1000,500,1000,900] data_color = [x / max(data_color) for x in data_color] fig, ax = plt.subplots(figsize=(15, 4)) my_cmap = plt.cm.get_cmap('GnBu') colors = my_cmap(data_color) rects = ax.bar(data_x, data_hight, color=colors) CS = plt.contourf([data_x, data_color],cmap=my_cmap) cbar = plt.colorbar(CS, cmap=my_cmap) cbar.set_label('Color',

Building a tag cloud with solr

会有一股神秘感。 提交于 2019-12-04 09:53:36
问题 Dear stackoverflow community : Given some text, I wish to get the TOP 50 most frequent words in the text, and create a tag cloud out of it, and thus show the gist of what the text is about in a graphical way. The text is actually a set of 100 or so comments PER each ITEM(a picture) there are about 120 items, and I also want to keep the cloud updated - by keeping the comments indexed, and using the cloud generation code to run each time a new web request turns up. I settled on using Solr to