question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

geom_line data series is getting sorted on SVG export

See original GitHub issue

Currently, I am working with geospatial data. I have a problem if I want to plot the contour lines. The dataset might not be sorted by the x-axis, as the lines might contain curves going back or might even be circles.

When I create a single Feature from a map containing all coordinates of the line via geom_line(map) the plot via PlotSvgExport.buildSvgImageFromRawSpecs(plotSpecRaw) is looking quite strange.

2020-09-14_15-59-23

If I inspect the resulting .svg, I can see that the plotted parts are sorted by x-axis, even though they are not sorted in the lists stored in the map

<path d="M616.0933693197439 278.4722567444842 L616.0933693197439 278.4722567444842 L616.1966374794138 276.7657731094514 L616.4902197569609 275.5389922473987 L616.6647073370405 279.4956226601789 L616.803585206857 274.6645176841994 L617.3199260049732 279.96274306534906 L617.5771072454518 273.76487838532194 L618.269518277375 273.5404928259668 L618.536591103999 280.47966867647483 L619.543554576172 273.66159811618854 L621.0407450590283 274.08468023399473 L621.7343430813053 282.2642678450211 L622.5383312052581 274.5764411095006 L623.7324434878537 275.1421233958681 L623.7553919677157 283.55396054615267 L624.679661779548 275.19612272438826 L624.9914445756585 284.2475635720184 L625.9081967819366 274.77356487192446 L626.1705216472037 284.54429774635355 L627.972768647538 285.60016811219975 L628.0847414030577 273.54363841793383 L628.8990167765878 286.4028183258197 L630.2122237566509 287.67625880186097 L630.7515130346874 288.0767975106428 L630.8927648852114 272.313711963885 L631.7430456324364 288.7090614934277 L632.9130224447581 289.1698907146638 L634.262630461948 270.51862748884014 L634.6357410922647 290.05852044170024 L635.3859189875075 269.9529452024435 L635.947365418484 269.46066006162437 L636.163397660479 291.3906786341977 L636.6259282298852 268.944258715841 L637.3472226934391 268.68317458365345 L638.4986033237074 268.6538157254399 L639.1150469739223 268.7177760951745 L640.4713812696282 269.01293747351156 L641.1756622050307 269.2079641746823 L642.5007390884566 269.679278702446 L643.8495557787246 270.51286057021935 L645.2537653515465 272.0500065051019 L646.2678507657838 273.40313531065476 L646.9278173950734 283.87952931338805 L646.9851885949029 282.57463291779277 L647.0263375933282 274.9402812454791 L647.1501802522107 284.27849522623 L647.4311012994731 281.26763946091523 L647.6835345785366 280.500639289472 L647.7432797590154 276.62893985945266 L648.0633714874857 279.31317832687637 L648.1464608113747 277.9679135011975 " fill="none" stroke-width="1.0" stroke="rgb(0,0,128)" stroke-opacity="1.0">
</path>

In case I plot every single line on it’s own, the file gets so huge that I can not see anything anymore.

Is there any way to force the svg export not to sort the given Features by x-axis? What can I do instead?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:18

github_iconTop GitHub Comments

1reaction
alshancommented, Nov 23, 2020

@mlthlschr Make sure you include the %useLatestDescriptors jupyter line magic because kotlin-jupyter-kernel 0.8.3.1 still doesn’t have the latest Lets-Plot package bundled with it.

1reaction
alshancommented, Nov 23, 2020

@mlthlschr Hi, there is a public Kotlin Kernel release available (kotlin-jupyter-kernel 0.8.3.1) which fixes the issue https://github.com/Kotlin/kotlin-jupyter/issues/107.

Last week we released Lets-PLot Kotlin API v1.1.0 that includes the support for GeoTools’s SimpleFeatureCollection, ReferencedEnvelope and Geometry objects - please, check out this updated demo: https://nbviewer.jupyter.org/github/JetBrains/lets-plot-kotlin/blob/master/docs/examples/jupyter-notebooks/geotools_naturalearth.ipynb

I think this exhausts all the issues discussed in this thread and I’m closing it now. )

Read more comments on GitHub >

github_iconTop Results From Across the Web

ggplot2 geom_line chart output quailty is poor. The time series ...
I am using the export option from the RStudio menu. I have yet to write the export code. I exported the image as...
Read more >
The tidyverse: dplyr, ggplot2, and friends
This lesson covers packages primarily by Hadley Wickham for tidying data and then working with it in tidy form, collectively known as the...
Read more >
Export to SVG or SVGZ—ArcGIS Pro | Documentation
Export all content as an image. For maps or layouts containing vector layers with a high density of vertices, this can drastically reduce...
Read more >
Quick Tip - Export SVG from Freestyle in Blender - YouTube
In this quick tip tutorial, I'll take you through the export SVG from Freestyle Add-on. I'll show you how to enable it, how...
Read more >
Export image as SVG in GIMP - Ask Ubuntu
Is this possible, or am I going to have to stick with exporting multiple sizes of an image? I know GIMP can read...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found