data-visualization

Add “rgb” legend to R leaflet heatmap

旧城冷巷雨未停 提交于 2020-01-24 05:50:05
问题 I made some interactive heatmaps using leaflet (particularly the addHeatmap() command from the leaflet.extras package) and shiny . Having created a desired map, I would like to add a legend to it. What I am interested in is a "rgb" legend, based on density values deduced by addHeatmap() from pure long/lat coords. What I need is something like this map - https://www.patrick-wied.at/static/heatmapjs/example-legend-tooltip.html - unfortunately I have no knowledge of JS and can't rewrite this

Using perceptually uniform colormaps in Mayavi volumetric visualization

懵懂的女人 提交于 2020-01-23 12:47:11
问题 AFAIK Mayavi does not come with any perceptually uniform colormaps. I tried naively to just pass it one of Matplotlib's colormaps but it failed: from mayavi import mlab import multiprocessing import matplotlib.pyplot as plt plasma = plt.get_cmap('plasma') ... mlab.pipeline.volume(..., colormap=plasma) TraitError: Cannot set the undefined 'colormap' attribute of a 'VolumeFactory' object. Edit: I found a guide to convert Matplotlib colormaps to Mayavi colormaps. However, it unfortunately doesn

x axis and y axis labels in pheatmap in R

亡梦爱人 提交于 2020-01-22 18:50:29
问题 I really like how the pheatmap package creates very nice looking heatmaps in R. However, I am trying to add x and y axis labels to the output (if one were just in plot(), one would use: xlab = 'stuff'). A simple example is as follows. require(pheatmap) ## Generate some data d <- matrix(rnorm(25), 5, 5) colnames(d) = paste("bip", 1:5, sep = "") rownames(d) = paste("blob", 1:5, sep = "") ## Create the heatmap: pheatmap(d) The above yields the following heatmap: I cannot for the life of me

Adding multiple reactive plots and tables to Shiny app

坚强是说给别人听的谎言 提交于 2020-01-22 16:17:14
问题 I am working on a Shiny app and as I go I have been adding figures and tables in a haphazard way. I would like to have a better framework so that I can flexibly add reactive figures and tables to the output as it develops further. At the moment I have been using tabPanel and fluidrow to add additional a summary table and a second plot. However I have had trouble adapting this. For example I currently generate 3 plots but have only able to plot 2 at a time. Could anyone show me a way to modify

Rows As Stacked Bar Plot Using ggplot2 In R

試著忘記壹切 提交于 2020-01-22 00:46:14
问题 I am just getting started with ggplot2() (data visualization) in R . The data I have has different workloads in row format. Each of these column has four different parameters that I want to plot as stacked bar plot, preferably using ggplot2() . Reproducible Data Workload P1 P2 P3 P4 W1 0.3 0.2 0.4 0.1 W2 0.5 0.1 0.3 0.1 W3 0.2 0.3 0.4 0.1 W4 0.3 0.2 0.5 0.1 I want to plot Workload as x-axis and then P1 , P2 , P3 and P4 will be stacked for each of the workload on y-axis . I tried many things,

Delaunay Triangulation of points from 2D surface in 3D with python?

不羁的心 提交于 2020-01-20 14:24:46
问题 I have a collection of 3D points. These points are sampled at constant levels (z=0,1,...,7). An image should make it clear: These points are in a numpy ndarray of shape (N, 3) called X . The above plot is created using: import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D X = load('points.npy') fig = plt.figure() ax = fig.gca(projection='3d') ax.plot_wireframe(X[:,0], X[:,1], X[:,2]) ax.scatter(X[:,0], X[:,1], X[:,2]) plt.draw() I'd like to instead triangulate only the

Delaunay Triangulation of points from 2D surface in 3D with python?

混江龙づ霸主 提交于 2020-01-20 14:23:34
问题 I have a collection of 3D points. These points are sampled at constant levels (z=0,1,...,7). An image should make it clear: These points are in a numpy ndarray of shape (N, 3) called X . The above plot is created using: import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D X = load('points.npy') fig = plt.figure() ax = fig.gca(projection='3d') ax.plot_wireframe(X[:,0], X[:,1], X[:,2]) ax.scatter(X[:,0], X[:,1], X[:,2]) plt.draw() I'd like to instead triangulate only the

Heatmap in matplotlib with pcolor?

Deadly 提交于 2020-01-18 03:42:08
问题 I'd like to make a heatmap like this (shown on FlowingData): The source data is here, but random data and labels would be fine to use, i.e. import numpy column_labels = list('ABCD') row_labels = list('WXYZ') data = numpy.random.rand(4,4) Making the heatmap is easy enough in matplotlib: from matplotlib import pyplot as plt heatmap = plt.pcolor(data) And I even found a colormap arguments that look about right: heatmap = plt.pcolor(data, cmap=matplotlib.cm.Blues) But beyond that, I can't figure

How to render table from JSON array elemnts using d3

谁说我不能喝 提交于 2020-01-17 13:59:08
问题 Folks, I want to render a html table for the following JSON using D3.js The JSON I am using for this proceess is here, http://jsfiddle.net/d9wgnbdd/2 For example, 'office type' has more 'code' and that 'code' having more 'cluster' also the clusters having more branches. I want to show the table as follows, need your help in this @mccannaff. Looking forward Code Office-code Corp-Code Region-Code Cluster-Code CO CRP CBE BN117 C1038 CO CRP CBE BN117 C1039 CO CRP CBE BN117 C1049 CO CRP CBE BN117

How to 3D plot function of 2 variables in python?

北城余情 提交于 2020-01-16 08:09:31
问题 I am trying to 3D plot the magnification factor in vibrations for multiple types of damping. To simplify it for those who have no idea what it is, basically, you have 3 variables: beta, which varies between 0 and infinite, but I would like to visualize it from 0 to 3, in 0.2 intervals. damping ratio, d, which varies between 0 and infinite, but I would like to plot it from 0 to 1, in 0.1 intervals. finally, nu, which is a function that varies according to the two variables before. My intuition