![]() Then we set the labels on the x axis (blue line in the code). Basically, f(x) returns 1, if x is smaller than A, g(x) does just the opposite, while h(x) produces a shift of its argument, if x is larger than A. In all three cases, we use the ternary operator that I discussed elsewhere. The first really important definition is that of f(x), g(x) and h(x), which are helper functions (green lines). By linking the definitions of eps and eps2 to xrange and yrange, we make sure that the lookout of the figure does not depend on the range we want to plot. C, D, E1, and E2 are just definitions for the x and y ranges, while eps and eps2 will be needed for the drawing of the slanted tics representing the discontinuity in the axes. The first several lines are just definitions: A is the position at which we want to break the line, B is the value by which the right hand side of the graph will be shifted, or, in other words, this is how much we cut out of the graph, when traversing the break point. Plot f(x)*sin(x) w l lt 1, g(x)*sin(h(x)) w l lt 1 Set arrow 6 from A-eps+eps2, E2-eps to A+eps+eps2, E2+eps nohead front Set arrow 5 from A-eps-eps2, E2-eps to A+eps-eps2, E2+eps nohead front Set arrow 4 from A-eps+eps2, E1-eps to A+eps+eps2, E1+eps nohead front Set arrow 3 from A-eps-eps2, E1-eps to A+eps-eps2, E1+eps nohead front Set arrow 2 from A-eps2, E2 to A+eps2, E2 nohead lc rgb "#ffffff" front Set arrow 1 from A-eps2, E1 to A+eps2, E1 nohead lc rgb "#ffffff" front The recipe that we are going to follow takes only a couple of lines, and it runs as follows.Ī=4.5 # This is where the break point is locatedī=3.0 # This is how much is cut out of the graphĭ=13 # The upper limit (with the cut-out) of the graph ![]() (This is just a sin function, broken at 4.5, and for the right hand side, displaced by 3). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |