
822 N.E.2d 609 (2004)
In re the Marriage of Robert HIGGINBOTHAM, Appellant-Petitioner,
v.
Kathryn HIGGINBOTHAM, Appellee-Respondent.
No. 55A01-0402-CV-91.
Court of Appeals of Indiana.
November 5, 2004.
Publication Ordered December 7, 2004.
*610 Michael A. Ksenak, Martinsville, IN, Attorney for Appellant.
Monty K. Woolsey, Miroff, Cross & Woolsey, Indianapolis, IN, Attorney for Appellee.

OPINION
BAKER, Judge.
Appellant-petitioner Robert Higginbotham, appeals the trial court's order regarding custody of his minor daughter, K.H., in favor of appellee-respondent Kathryn Higginbotham. Specifically, Robert raises three issues, which we consolidate and restate as whether the trial court abused its discretion by: (1) rejecting the parties' agreement to continue joint legal custody; and (2) terminating Robert's midweek visitation and conditioning its resumption upon K.H. showing vast improvement in her scholastics. Finding no error, we affirm.

FACTS
Robert and Kathryn were married on January 6, 1989. K.H. was born on November 6, 1991, and the Higginbothams' marriage was dissolved on July 17, 2002. Pursuant to the parties' agreement, which was approved by the dissolution court, Kathryn was to have primary physical custody of K.H., and the parties were to share joint legal custody.
On June 27, 2003, Robert filed his Verified Petition to Modify Custody, alleging that there had been substantial changes in circumstances that were not in K.H.'s best interests. Subsequently, Robert and Kathryn agreed to a custody evaluation that was performed by Dr. John C. Ehrmann, Jr., which recommended that custody remain the same with the addition of the appointment of a parenting coordinator. If the trial court chose to grant sole custody to one parent, Dr. Ehrmann "strongly endorsed" Kathryn as the custodial parent. Appellee's App. p. 69. Dr. Ehrmann also *611 noted that all of the adults involved appeared reasonably healthy from a psychological perspective but that there was a clear pathology present in Kathryn and Robert when they interacted with one another. Dr. Ehrmann found that K.H. is an "extremely vulnerable child in a high-risk situation unless the conflict between her parents is resolved." Appellee's App. p. 69.
The trial court held a hearing on the petition on February 5, 2004. Robert and Kathryn stipulated to the admissibility of Dr. Ehrmann's evaluation and agreed with his recommendation. Robert requested the trial court grant him overnight visitation on Wednesdays and Sundays. Kathryn raised concerns about such an arrangement because K.H. returns from her Wednesday night visitations with Robert with homework that is incomplete or that needs to be redone, and she does not get assistance at Robert's home with her homework. Kathryn further testified that K.H. comes home from Robert's house emotionally distressed and upset because she is not getting the cooperation and assistance she needs while she is there. K.H.'s most recent report card reflected below average grades in Science, Math, and Social Studies, and she did not pass the portion of ISTEP testing relating to English and Language Arts. Moreover, Robert had threatened not to give K.H. her prescribed medications for her Attention Deficit Hyperactive Disorder (ADHD) and anxiety disorder.
On June 11, 2004, the trial court issued its order on the petition. The trial court gave full physical and legal custody of K.H. to Kathryn, eliminating Robert's midweek visitation and conditioning its resumption upon K.H. showing a "vast improvement in her scholastics." Appellant's App. p. 13. Robert now appeals.

DISCUSSION AND DECISION

I. Custody
Robert first argues that the trial court erred in terminating joint legal custody. Specifically, he contends that because the parties agreed to Dr. Ehrmann's custody evaluation, that the trial court was without authority to terminate joint legal custody.
Upon appeal, a trial court's decisions concerning custody modifications are accorded latitude and deference, and will only be reversed for an abuse of discretion. Arms v. Arms, 803 N.E.2d 1201, 1208 (Ind.Ct.App.2004). An abuse of discretion occurs when the decision is clearly against the logic and effect of the facts and circumstances before the trial court. Hanks v. Arnold, 674 N.E.2d 1005, 1007 (Ind.Ct.App.1996). We will not substitute our judgment for the trial court unless no evidence or legitimate inferences support its judgment. Arms, 803 N.E.2d at 1208.
Indiana Code section 31-17-2-13 provides that the trial court may award legal custody of a child jointly if the trial court finds that an award of joint legal custody would be in the best interests of the child. In making this determination, Indiana Code section 31-17-2-15 directs the trial court to consider it a matter of primary, but not determinative, importance that the persons awarded joint custody have agreed to an award of joint legal custody. "A court may not modify a child custody order that granted joint legal custody unless (1) the modification is in the best interests of the child; and (2) there is a substantial change in one or more of the factors a court may consider under Indiana Code § 31-17-2-8 when it originally determines custody." Apter v. Ross, 781 N.E.2d 744, 758 (Ind.Ct.App.2003), trans. denied. The factors to be considered *612 under Indiana Code section 31-17-2-8 are:
(1) The age and sex of the child.
(2) The wishes of the child's parent or parents.
(3) The wishes of the child, with more consideration given to the child's wishes if the child is at least fourteen (14) years of age.
(4) The interaction and interrelationship of the child with:
(A) the child's parent or parents;
(B) the child's sibling; and
(C) any other person who may significantly affect the child's best interests.
(5) The child's adjustment to the child's:
(A) home;
(B) school; and
(C) community.
(6) The mental and physical health of all individuals involved.
(7) Evidence of a pattern of domestic or family violence by either parent.
(8) Evidence that the child has been cared for by a de facto custodian, and if the evidence is sufficient, the court shall consider the factors described in section 8.5(b) of this chapter.
Here, Robert contends that the issue of joint legal custody was not properly before the trial court. Contrary to this argument, however, the record shows that he filed an open-ended petition to modify custody that requested that the trial court, "enter an order modifying custody after a custody evaluation has been conducted and appropriate hearing held; and for all other relief proper in the premises." Appellant's App. p. 22. Moreover, Dr. Ehrmann's evaluation, which was stipulated into evidence by both parties, contained two recommendations: (1) that joint legal custody continue; and (2) that if joint legal custody was not continued, Kathryn be given sole custody of K.H. Thus, the issue of joint legal custody was squarely before the trial court. Appellant's App. p. 69.
Although Robert and Kathryn agreed to continue joint custody, the record demonstrates that the breakdown in communication and cooperation between them was adversely affecting K.H. to the point that it was no longer in her best interest to continue joint legal custody. Because she was not getting the help she needed with her homework and medications during her Wednesday visitations with Robert, K.H. returned to Kathryn's house emotionally distressed and upset. Tr. p. 48. Her grades were below average, and she did not pass the ISTEP relating to English and Language Arts. Appellee's App. p. 79, 84. Robert and Kathryn could not agree on K.H.'s medication for her anxiety and ADHD. Tr. p. 53-54. Moreover, Dr. Ehrmann noted that when Kathryn and Robert interacted with one another, they "[b]oth behave with one another like children." Appellee's App. p. 68. Thus, there was ample evidence before the trial court that joint legal custody was no longer in K.H.'s best interest.

II. Visitation
Robert next contends that the trial court erred in terminating his midweek visitation and conditioning its resumption upon K.H. showing vast improvement in her scholastics. Specifically, he avers that there was insufficient evidence in the record to support the trial court's termination of his visitation and that its resumption is contingent upon a vague and unobtainable standard.
Upon review of a trial court's determination of a visitation issue, we will reverse only when the trial court manifestly abused its discretion. Appolon v. Faught, 796 N.E.2d 297, 299 (Ind.Ct.App.2003). No abuse of discretion occurs if there is a rational basis in the record *613 supporting the trial court's determination. Id. We will not reweigh the evidence or judge the credibility of witnesses, but rather we will look only at the facts most favorable to the judgment and the reasonable inferences therefrom. Id.
Indiana Code section 31-17-4-1 provides, "A parent not granted custody of the child is entitled to reasonable visitation rights unless the court finds, after a hearing, that visitation by the noncustodial parent might endanger the child's physical health or significantly impair the child's emotional development." Additionally, Indiana Code section 31-17-4-2 states that when modifying existing visitation rights of the noncustodial parent, "the court shall not restrict a parent's visitation rights unless the court finds that the visitation might endanger the child's physical health or significantly impair the child's emotional development." We also note that when issues not raised by the pleadings are tried by the express or implied consent of the parties, they shall be treated in all respects as if they had been raised in the pleadings. Ind. Trial Rule 15(B).
Robert first argues that the trial court had no authority to modify visitation because that relief had not been requested in the petition. However, at the hearing, Robert requested that the trial court modify his visitation to grant him overnight visitation on Wednesdays and Sundays. Tr. p. 11. Kathryn also presented evidence regarding the issue of visitation by raising concerns about the effects of Robert's Wednesday evening visitations with K.H. Tr. p. 21-22. Thus, it is apparent to us that the parties consented to try the issue of visitation, even if it was not raised in the pleadings.
The evidence showed that K.H. is an extremely vulnerable child in a high-risk situation. Appellee's App. p. 69. Kathryn raised concerns at the hearing that K.H.'s Wednesday night visitations with Robert were contributing to K.H.'s difficulties at school because she would return to Kathryn's house with incomplete or substandard homework. Tr. p. 45. As a result, K.H. was emotionally distressed and upset because she was not getting the cooperation and assistance she needed while in Robert's home. Id. Moreover, Robert does not give K.H. the medication prescribed for her anxiety while she is in his care, instead asking her if she needs it. Tr. p. 54. Robert also threatened to withhold some of K.H.'s prescribed medication. Tr. p. 53. In light of K.H.'s scholastic and emotional difficulties, which are partly attributable to her Wednesday night visits with Robert, we cannot say that the trial court erred in suspending Robert's weekday visitation.
Finally, Robert avers that it was an abuse of discretion for the trial court to condition the resumption of the Wednesday visitation upon K.H. showing a vast improvement in her scholastics because it is a vague and unattainable standard. However, considering that K.H.'s academic problems were part of the basis for the suspension of Robert's Wednesday night visits, we can only conclude that the trial court acted reasonably in permitting the visits to resume when K.H. shows scholastic improvement. Thus, there was no error.
The judgment of the trial court is affirmed.
KIRSCH, C.J., and ROBB, J., concur.

ORDER
This court having heretofore handed down its opinion in this appeal in November 5, 2004, which opinion was marked Memorandum Decision, Not for Publication.
Comes now the Appellee, by counsel, and files herein Motion to Publish, alleging therein that the Memorandum Decision *614 clarifies that a trial court may modify joint legal custody in a subsequent modification proceeding where a change in circumstances warrants the modification despite the agreement of the parties and the desire to continue joint legal custody.
The Appellee further alleges that the decision should be published for the reason that it clarifies that issues, such as modification of visitation, can be determined by the Court, even if not raised by the parties in their pleadings so long as they have raised the issue and tried it by consent at trial.
The Court having examined said Motion to Publish, having reviewed its opinion in this matter and being duly advised, now finds that the same should be granted.
IT IS THEREFORE ORDERED that the Appellee's Motion to Publish is GRANTED, and this Court's opinion in this appeal heretofore handed down in this case on November 5, 2004, marked Memorandum Decision, Not for Publication, is now ORDERED PUBLISHED.
All Panel Judges Concur.
