Why is the trend of using percentiles to divide the Logit model different from the trend of using percentiles as the knots’ restricted cubic spline? I am trying to analyze the effect of air pollutant on health.
First, I used the restricted cubic spline with three knots which were 25th, 50th, 75th percentiles of the pollutant and the result was Figure1: it looks a linear relationship. And then, I divided the data set into four parts by the 25th, 50th, 75th percentiles of the pollutant, and conducted  logsitic regression for each part, the result was Figure2.
I am confused that why the trend in Figure2 is not a ascending line? Because in my opinion, it should be the same as Figure1.
Please help me, it bothered me for several days.


And the restricted cubic spline model is :
k <- with(Data, quantile(Pollutant, c(.25, .50,.75)))
model_rcs <- lrm(disease~rcs(Pollutant,k)+temperature+humidity+age+gender+job,data=Data)
the logistic model is:
model_log <-glm(disease~Pollutant+temperature+humidity+as.factor(age)+as.factor(gender)+as.factor(job),family = binomial() ,data=Data_Q1) (or Data_Q2\Data_Q3\Data_Q4)
 A: The second graph is misleading because it assumes a discontinuous relationship when the true relationship is continuous.  Possibly even more problematic: you are constructing intervals from quartiles.  Quartiles tell us about the distribution of X and are completely disconnected from the shape of the relationship between X and Y.  How many points are near a given X=x should not inform us of how X relates to Y at x.
The knots in splines should not be confused with points of discontinuity in the estimated values of Y.  In a cubic spline function, the knots are points of discontinuity in the third derivative ("jolt") of the function.  The human eye cannot see discontinuities in the third derivative.  It can only see discontinuities in the function and in its first derivative (slope).  Details about this along with an graph illustrating the derivatives may be found in my RMS course notes.
A: A few things to note. Most obvious, but probably least important, you model age as a continuous linear predictor in the first model but as a factor in the second model.
Second, note that your second model is actually a set of 4 separate models done on 4 different subsets the data. The effects of temperature, humidity, age, gender, and job are modeled separately within each subset, rather than all together as they are in the first model. That could certainly lead to this type of result. (That's pretty much what Nick Cox is saying in a comment that appeared as I was writing this.)
Third, the results from the separation into 4 models will differ depending on the distributions of the Pollutant values within each of the quartiles. For example, if for one or more quartiles they are bunched near one of the edges of the quartile cutoffs, comparing the results against the continuous fit could be quite misleading. (That's related to what Frank Harrell says in the first paragraph of his answer.)
