Maintain shared stack 'center' axis for layered plots - visualization

I'm trying to create a faceted violin plot that has a shared interval selection between the facets. While I was able to get the interaction shared across the facets, I'm seeing weird behavior with each layer having it's own center axis for the stack. Causing the filtered section to not align with the unfiltered background distribution.
Is there a way to maintain axis consistency across layers?
I tried differing stack alignments (center, left, right, etc); however, that doesn't seem to solve the issue as that will change it to a different type of chart rather than the centered violin plot.
I also tried elevating the encoding to a shared level. This didn't seem to fix the issue either.
Vega editor example
Colab example

Related

Perspective control in MATLAB 3D figures

How to change the vanishing points (P1,P2,P3) in the perspective in MATLAB 3D figures?
Below there is a scheme of explanation what I mean:
Thanks in advance for your help.
If you want to control the perspective appearance in a plot, you'll want to first change the Projection property of the axes to perspective. Then you can change the various camera properties of the axes to get the view you want. The important ones for adjusting how the perspective looks are the CameraViewAngle and CameraPosition.
I have found that a "realistic" perspective view can be achieved using a CameraViewAngle of about 30 degrees, mimicking the preferred viewing area of the human eye:
The default CameraViewAngle is about 6.6, so setting it to 30 will cause the view to appear zoomed-out. You will then want to change the CameraPosition so that it is closer to the CameraTarget, thus zooming the view back in. You can use a larger CameraViewAngle if you want a more exaggerated perspective (like a fisheye lens).

Plotting 140K points in leafletjs

I'm new to leafletjs. Been working on cesiumjs for a while and we are trying leaflet now. The main reason for the switch is to see if there's a huge performance difference.
In Cesium, I had a collection of primitive points that I plotted. What's the most efficient way of plotting 140K points in leafletjs? Using markers or creating individual little circles?
I am also thinking of using the clustering plugin (http://leafletjs.com/2012/08/20/guest-post-markerclusterer-0-1-released.html), so please share any thoughts on performance.
You have 2 common options:
Display your points in a Canvas-based layer, like using Circle Markers and force rendering them on a Canvas instead of SVG (see also Leaflet MaskCanvas plugin). Circle Markers, even on a canvas, still emit events, so you can detect "click" etc.
Use a clustering plugin, like Leaflet.markercluster plugin that you mention for exampe. It can handle your 140k points, depending on the client's computer performance (see https://github.com/Leaflet/Leaflet.markercluster#handling-lots-of-markers and demo http://leaflet.github.io/Leaflet.markercluster/example/marker-clustering-realworld.50000.html with 50k points, but note that the demo uses an old version of the plugin, whereas the current version is even faster).
Trying to display your 140k points without Canvas or clustering will crash your browser for sure.
If you want to render more than 100k markers, you can use Supercluster library, because Leaflet.markercluster loading of >100k markers could take more than 30 seconds.
I created a github repo to compare initial loading of Leaflet.markercluster and Supercluster.

Customizing a 3D Plotly Visualization with a slider bar

I've been exploring Plotly recently. I've made a contourslice of a 3D Value function using the Plotly MATLAB API's fig2plotly(). However, I've been researching how to further customize the plot, and I can't figure out how exactly I'd go about doing this.
My current plot is here:
https://plot.ly/~txizzle/81
It's basically different contours stacked on top of each other.
My goals:
I'd like to add a slider bar that will show just one contour slice at a time (maybe by changing visibility). Ideally, I could fix an eagle-eye view from the top, so moving the slider will make it appear as if the plot is 2D.
My thoughts on how to approach this:
1) https://plot.ly/javascript-graphing-library/range-slider/ seems to be an HTML/JS implementation of a custom slider bar that changes the x-axis range of a line chart. From what I've read, this approach seems to be Node.js only. Ideally, I'd like to implement something in just HTML/JS/JQuery/D3.js.
2) Alternatively, I could use a 2D contour plot instead of a 3D contourslice:
https://plot.ly/49/~txizzle/
However, now, I will need to have many of these contour plots. I'm not sure how I would switch between different contour plots with a slider.
My Questions:
1) How do I customize Plotly plots? Is this possible without relying on Node.js? I don't want to just embed the plots using Plotly's given auto-embedder, because it abstracts everything away.
2) Should I do a contourslice or many different contour plots?
3) How do I add a slider bar to switch the visibility of different contour slices, or how do I add a slider bar to switch different plots entirely?
Thank you for your time! Looking forward to explore Plotly more.
Since you used the MATLAB library to generate the plotly figure, you can add slider effects by embedding the plotly figure as an iframe in an offline HTML doc, then using Plotly's postmessage API.
Here's an example:
https://plot.ly/matlab/range-slider/
postMessage API:
https://github.com/plotly/postMessage-API

Mapbox Studio - layer ordering / z-index

I am following the source quickstart tutorial. I have followed the tutorial all the way through, and am having trouble displaying the earthquake data (red circles) above the land vectors.
According to the symbol drawing order documentation:
“Higher” layers obscure “lower” ones.
However I'm not finding this to be the case. Please see attached screenshot:
The 'earthquakes' layer is the 'higher' layer, I think. I am using the 'Comic!' base map styles. Since the road lines also appear to 'mask off' the land vectors and show the earthquake data below, I'm wondering if this is causing the issue, but looking through the styles there's nothing obvious I can see.
Thanks for any help.
The documentation is correct, however the comp-op family of CartoCSS properties affect how the colors of different layers interact with each other. In this case, the marker-comp-op: screen from the quickstart example was designed to work well over a darker satellite background, but becomes nearly invisible over solid white.
If you remove the marker-comp-op property or change it to a different compositing operation such as multiply the earthquake markers should show up fine.

GUI Layout Toolbox - Strange display with card panel object

Context
Using the GUI Layout toolbox I have created an interface which basically is divided in two parts:
A toolbar area where the user selects the way he want to see data
A preview area to display data upon selected mode in the toolbar
For the preview area I used a uietxras.CardPanel object to switch between the view modes.
Problem
After some investigations, I discovered that if I display things in 3D (or 2D) in one of the preview card using surf (or pcolor) then it alters the display in the second card. If I display data in 1D only using plot commands I have not issue!
The issue I have when using pcolor/surf in one of the preview card:
Titles and labels seem to overlay in Preview 1
Axis borders are not displayed correctly in preview 2
Legend borders (when displayed) are altered also
If I only use plot commands in both preview modes I have no issue at all and cards are switching nicely.
Test case
My real code is really long, I have thus reduced it to the minimum so you can reproduce the issue:
https://gist.github.com/CitizenInsane/54f3c1eba2293d0e5264#file-guilayoutbug-m
Simply run the code and check the checkbox "Do 3D plot in preview 1" to see the issue happening when switching between the two preview modes:
Notes
As far I know, I'm using latest version of the GUI Layout toolbox (1.17).
I'm using R2013b for Matlab
I came across this issue as well. I'm afraid I never quite worked out what the cause was exactly, and it didn't appear in a very consistent way. The issue seems to be that plots on non-selected cards are not hidden properly, and get overlaid just behind and around the edges of the plots on the selected card.
I would encourage you to raise the issue with the authors of GUI Layout Toolbox via the comments on the toolbox's page at MATLAB Central, as I do think it's a bug.
Nevertheless, the reason I never followed it up myself is that I found a fairly straightforward workaround, which may also work for you. Each time the selected card is changed, I ran a simple function that deleted all children of all cards, and then re-plotted whatever I wanted on the selected card. It seemed a bit annoying to have to do that, but it worked, and removed any of the display issues you've come across.
Ok got it, the issue has nothing to do with CardPanel themselves, it is linked to the renderer of the figure.
Trying simple code below:
figure(42);
subplot(1,2,1);
plot(rand(1,12));
subplot(1,2,2);
peaks;
shading flat;
If the figure's renderer is set to 'OpenGL' (the default) ==> there are some glitches:
If the figure's renderer is set to 'zbuffer' ==> there is no glitch:
Setting the renderer to 'zbuffer' fixes the problem.
NB: Maybe OpenGL rendering can be fixed by fine tuning graphic card acceleration settings, but I don't know ... I issued opengl software and opengl hardware commands in Matlab and software rendering is worst than hardware rendering on my machine.
EDIT: Side notes
Transparency effects are only available if the renderer is set to 'openGL'. It is thus not possible to visualize at the same time both 1D and transparent-3D data without glitches (at least with hg version 1 in R2013b).
HG2 has no issue: