displayHTML in Azure Databricks shows only a small slice of a leaflet map - leaflet

I'm attempting to display an HTML file (a leaflet map) using displayHTML() inside a notebook. The file is created with the R mapview package, after following https://docs.databricks.com/notebooks/visualizations/htmlwidgets.html to make it all work. The HTML file is valid and I can open it in a browser window with full functionality.
What's happening in the notebook is that in the cell output, the map is only rendering as a very short slice of the map:
The visual appears to be fully functional, but I cannot figure out how to increase the size of the render/display area. I imagine it's either something within the HTML itself (like it's fitting to the size of the pane of the Databricks cell output, which it's thinking is a single line, perhaps), or there's a Databricks setting I'm not seeing. Resizing the cell output with a click-drag on the bottom-right corner has no effect.
Is there a way to make the map take up more space in a cell output?
DBR 9.1 LTS

Related

How to Crop Stacks in ImageJ without first Duplicating

I am using imageJ for automated microscopy of live cells.
The microscope centers the stage on a desired cell, takes a Z-stack, and passes this stack to imageJ.
I want to then use Analyze Particles to output the area of the cell in each Z-slice. (this works well)
To do this I use a macro which performs the following:
A region is selected.
The selected region stack is duplicated
the stack is autothresholded.
Analyze particles is run for the stack (with objects on border excluded)
the maximal area result is found
the corresponding z-slice is printed in a file for further work.
This all works well except the duplicate step is far too slow for the pipeline. I need to avoid the duplication step somehow.
Is there any way to crop the stack without first duplicating? (currently this loses information from all but one slice)
Or, can I apply the threshold and analyze particles only to the selected region?
Cropping a stack can be done in a macro using run("Crop"); following an appropriate selection.

How to display a big figure with mlpd3 inside jupyter notebook?

I am using jupyter-notebook to write some python code and generate figures. As I wanted to add tooltips on mouse hovering and other interactions with the generated graphs, I now use mpld3 to display the graph.
However, as I have quite a lot of things to plot, I need to increase the figure size. So, I putfig = plt.figure(figsize=(20, 10)).
When I display with the standard way, I can see all the figure in my notebook (with horizontal sliders if I increase a bit more the figsize).
But with the mpld3 display, the size of the zone where the figure is displayed seems to be fixed, and hence, I can only see the upper left part of my figure. There are no sliders or anything to increase the displaying zone size.
For example, this code generate a graphic, for which you will see only the upper left part:
fig = plt.figure(figsize=(20, 10))
plt.plot([3,1,4,1,5], 'ks-')
mpld3.display(fig)
Does anyone know how to deal with this ? That is, how to increase the default display zone size, in order to have bigger graphs ?
Thanks
Edit after comment:
Here is a screenshot of how it is displayed on my machine...
And I would like it to be displayed just as it is on yours !
So I guess the problem comes from elsewhere... do you have any idea of how to solve this ?
I hope I do understand your question correctly but in Ipython Notebooks you can only use excisting space and not flip the notebook into wide screen mode or alike. In my notebook the graphic is also displayed like you show.
However, there is an easy fix, simply reduce the figsize to for example (10, 5). The main idea with interactive plotting with mpld3 is that the user can zoom in to specific interesting details. For the presented example it would not make much sense but richer graphs are great to be explored interactively.

How to make a DEM in QGIS using spot heights and contors

I have 2 shapefiles. One is the contors of an area and the other the spot heights. Both of them has a altitude attribute. In ArcGIS there is a tool called topo to raster were you can use both these features to create a dem. In qgis I have only found tools were you can only use one.
Any Ideas?
There is only the interpolation tool that I know of which will create a DEM. Depending on the resolution you're after, you could BUFFER the spot heights, then MERGE SHAPE FILES and run the interpolation tool on that.
Using the graphical modeler would prevent the buffer layer being created making the process a little tidier (and i'm sure there's a better way using the python console). Hope this helps.

Dynamic grid of images in MATLAB

I'm working on creating a GUI in matlab using GUIDE. However, i'm not exactly sure how to do the following, and was looking for some tips/advice.
Problem
I want to open a directory and display all the images in that directory in the GUI interface when if it's selected. However, since I will never know exactly how many images there are I am not entirely sure how to do this in the GUI.
Essentially, I want to open the directory and all the images to be displayed in a grid on the GUI similar to that in iphoto.
Current code
Currently, I can open a directory fine, and get all the required information as follows:
directory = uigetdir(pwd, 'Directory Selector');
files = dir(fullfile(directory, '*.jpg'));
strcat(strcat(directory, '/') , files.name) %outputs each file's location
I'm just not sure how to translate this information into the GUI without writing numerous handles.axes1. I understand that since I know this info I could loop over them, but would I not have to create the axes to begin with?
You probably don't want to do this with individual controls - the reason is that MATLAB will have to render each and every one, which will be slow if the directory has a lot of images. Clearly, you can only display a certain number of images on screen at once. You would also have to write your own scrolling code (or some kind of pagination control).
If you have MATLAB > R2008, you can put images in uitable cells using HTML:
% Example for a control with a 'String' property
set(handles.myControl, 'String', '<html><b>Logo</b>: <img src="http://UndocumentedMatlab.com/images/logo_68x60.png"/></html>');
See also this post and this Undocumented MATLAB page.
A different option would be to use the Windows common controls ListView.
A simpler way of doing this would be to have a single image and a listbox of files; an example is here
You can add components to a GUI pprogrammatically. There's more information here.
Each new axes can be added with something like this:
ah = axes('Parent',hObject,'Position',[left bottom width height]);
where left, bottom, width and height define the size and position of the axes. You'll need to change the position for each axes you create and keep track of the axes handles.

Is it possible to determine the (pixel-)width of text-strings bevore SVGs are created with scripts

I am about the create a bunch of SVG graphics with (probabably) a perl script. These SVG graphics will contain text blocks. Since I want to "connect" such text blocks (of varying widths) with lines I'd like to know what width a text will be so that I can draw the connecting lines' length accordingly.
I have seen in SVG get text element width that it could be possible with java script. But that's probably not what I am after since I don't intend to host the SVG in a browser.
So, I thought that maybe there's a way to find out the desired width at the script's runtime. If someone can point me to a solution (also outside the realm of perl but on windows), I'd be very gratefu.
I did that exactly that about a year ago using PDF::API2 and advancewidth function: https://metacpan.org/module/PDF::API2::Content#width-txt-advancewidth-string-text_state-
Note that you need to correlate DPI of PDF and SVG: they may be different (I actually did that just dividing values by 1.25, you can be better).
PDF::API2 gives you very accurate values that works for Inkscape (in my case) well.