Coder Social home page Coder Social logo

Comments (4)

Phlya avatar Phlya commented on August 19, 2024 1

Another option without increasing axes limits is to increase the size of the figure - and, actually, your plot from R is physically bigger.
image

I agree that there is a lot of whitespace that could be used, however normally I would prefer for the labels to stay as close to their points as possible... This is especially important in more complicated plots, where if texts fly far away their connectors to the points can start crossing, that is ugly and confusing and best avoided.

from adjusttext.

Phlya avatar Phlya commented on August 19, 2024

Hi. It works quite well with all default parameters for me - except for one fully overlapping pair of labels:
image
That is due to the fact that their coordinates are exactly the same. Normally this should be solved during autoalignment (and it did separate the third label with the same coordinates), but here they are too close to the edge of the axes and are right next to other points/labels, so this fails, because there are only so many options how a text can be aligned. So the easiest solution is to slightly increase the axes limits, let's say -0.1 instead of -0.05:
image

I'll leave the fine-tuning for you, but just taking your force changes actually speeds up the algorithm significantly in this case, and also leads to a good result:
image

An alternative solution to fully overlapping labels is adding a tiny (random, or not) shift to one or more of these points, so that visibly the change is unnoticed, but the algorithm can actually do something with them

Hope this helps!

from adjusttext.

Phlya avatar Phlya commented on August 19, 2024

I'm very curious how ggrepel deals with these cases, actually... Will have to have a look at their code, although I don't know R well.

from adjusttext.

slochower avatar slochower commented on August 19, 2024

Huh, you are correct! I initially had a more complicated example, started messing the parameters, and then pruned it down here. But you are correct that the default settings do an okay job here. I agree that increasing the axis limits helps even further, although I still contend it would be nice to use some of the upper half of the graph for the labels. Feel free to close the issue.

from adjusttext.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.