I am writing an application in Java (do not offer third-party libraries, please), you need to draw a graph of the function entered from the keyboard. I used g.drawPolyLine(xArray[], yArray[], numOfPoints) , g - an object of class Graphics , also tried g2.draw(new Line2D.Double(double x1, double y1, double x2, double y2)) , g2 - object Graphics2D class, I thought that in the second version the graph will be clearer, but all the same, it turns out some pixels that are sharply striking, here's an example: 
If you make a "feather" thicker, the result is the same. I tried to see how normal graphics are drawn on sites on the Internet - the thickness of the “pen” is 2 pixels, and one of them is lighter, and it creates the illusion that pixelation is not visible. Is it possible to achieve the same result in another way, or how to implement the same (as on websites)?
I tried to set KEY_ANTIALIASING to VALUE_ANTIALIAS_ON (enabled anti-aliasing), improved the quality of the render, didn’t really change (the line became thicker and that’s if the scale was increased, it became a little better, and that’s all).
Here is: 
There is nothing changed except the render settings. It looks a little different, but still not the way we would like. If someone says that it is impossible to do better, here is an example:
Screenshot from a graphing site . I would like to get just such a result.