I am trying to create a scatter plot (see image with code), but keep getting this super compressed single dot as the plot. I was unsure if it was an issue with the code or the data, so any help appreciated :)
The graph in question + code
Related
Original binary image
Find contours result
I'm dealing with images like 1. There is some small connection between squares as you can see, currently I'm directly applying cv2.findContours on the image and the result is connected squares are detected as a big object while I want them to be separated. Can someone help me to get this work?
You should be able to solve this issue by applying morphological transformations + watershed transformation on your source image.
Segmenting connected contours is a quite common use-case, you can find a tutorial for a similar problem in the OpenCV documentation:
https://docs.opencv.org/4.x/d3/db4/tutorial_py_watershed.html
I was recently doing some EDA on a data set.I created a boxplot, a countplot and a violinplot using seaborn and created an image using matplotlib.
But the result is not very easy on the eye and looks very congested.
Is this normal? Any way to make it better ?
This is the image of the notebook
The answer depends on your problem:)
In my opinion, the spacing is not the problem, the aspect ratio is. Your individual plots don't have enough height. So try to change te aspect ratio and see if you like it better. So change the first line to:
plt.Figure(figsize=(8, 12)
for example.
I'd like to build a chart similar to:
Elevation over distance
This chart shows 3 things: elevation (y) distance (x) and colour represents the gradient change. How can I replicate this using D3.js?
You can check sample in the samples and pick something suitable for you depending on your requirement. But I'm suggesting something like this or this . First one does not give you color changing capability with it. You may need to read the documentation and find out. You can use the second one after reducing the width of bar to be very small. You may need to convert this to cater your data input method. I'm strongly suggesting you to go through the samples. As a help I'm posting few more samples you can customize.
Area Gradient fill
Applying a colour gradient to an area fill in d3.js
I am trying to plot a line chart using D3.js. The problem is that for some stock symbols the graph is correct and for some it gives a wrong chart.
I have attached two images. One showing a line chart that shows the wrong graph for a particular stock.The other one shows the correct graph for an another stock.
Look the d attribute of the path tag in the svg (in the images that I hace attached).The values of the d attribute are way off the charts for the wrong graph.The two graphs that I have shown are generated from the same program.
Wrong Chart
Correct Chart
Your scale is off. If you look at the axis on your wrong chart the numbers are in a tight range, apparently outside of the highs and lows. Check the code where you define the domain for the y scale.
I have created a simple line graph with data from a mySQL database using PHP to return the data in JSON format.
https://gist.github.com/5fc4cd5f41a6ddf2df23
I would like to simulate "live" updating something similar to this example, but less complicated:
http://bl.ocks.org/2657838
I've been searching for examples on how to achieve this simply as new to D3 - to no avail.
I've looked at Mike Bostock's http://bost.ocks.org/mike/path/ path transitions, but not sure how to implement this using json data.
Can anyone help with either an example or some direction on how I could accomplish this?
Doing that kind of line transformations is tricky in SVG because moving large number of points just a little and rerendering the complete line can hurt performance.
For the case when interactivity with each data point is not paramount and the time series can grow to contain arbitrary number of points, consider using Cubism. It is a library based on d3 but meant specially for visualizing time-series data efficiently. To prevent rerendings of SVG, it draws the points on a canvas, allowing for cheap pixel by pixel transitions as new data arrives.